How to Decode a Base64 Encode
import base64

a = "aGVsbG8"
d = a.encode()

print(d)

z = base64.b64decode(d)

It is showing error I already know that this encode's decode is hello but I was trying to get a encoded text of base 64 to decode in a new file but I was unsuccessful. Can anyone solve my problem?

MY PROBLEM IN EASY WORDS :)

its encoded version of hello from base64... I am trying if I get a text suppose from my friend that is encoded from base 64 then can I decode it from base64 only, in my pc?

Answer Thanks @Olvin

we just need to add "=" in a = "aGVsbG8" so it will be a = "aGVsbG8="

and it worked !!!

7
Marcus Vance

Marcus Vance

Cybersecurity & Digital Privacy Researcher

Marcus Vance is a cybersecurity auditor and technology writer dedicated to educating the public about online safety, data privacy regulations, enterprise security, and emerging cyber threats.

Share this article