Base64 Decode Base64 Encode
More Tools
Other tools: Base64 Image Encoder | Base64 Image Decoder | Url Encoder | Url Decoder

Python base64.b64encode()

Encode a string use Base64


base64.b64encode(s[, altchars])


s - is the string to encode.
Optional altchars must be a string of at least length 2 (additional characters are ignored) which specifies an alternative alphabet for the + and / characters. This allows an application to e.g. generate URL or filesystem safe Base64 strings. The default is None, for which the standard Base64 alphabet is used.

Return values

The encoded string is returned.

<<< import base64
<<< encoded = base64.b64encode('base64 encoded string')
<<< encoded