Base64 Decode Base64 Encode Image to Base64 Base64 to Image

Python base64.b64decode()

Decode a Base64 encoded string


base64.b64decode(s[, altchars])


s - is the string to decode.
Optional altchars must be a string of at least length 2 (additional characters are ignored) which specifies the alternative alphabet used instead of the + and / characters.

Return value

The decoded string is returned. A TypeError is raised if s were incorrectly padded or if there are non-alphabet characters present in the string.

<<< import base64
<<< encoded = 'YmFzZTY0IGVuY29kZWQgc3RyaW5n'
<<< data = base64.b64decode(encoded)
<<< data
'base64 encoded string'

See also:
Python base64.b64encode uses cookies for personalization and functionality. By continuing using this website, you agree to our use of cookies. More info