Base64 is a binary-to-text encoding scheme that represents binary data as a sequence of 64 characters (letters and numbers).

How it works

Base64 encoding works by dividing the binary data into 6-bit blocks and then representing each block as a character in a predefined set of 64 characters.

The symbol "=" is used as padding.

This results in a representation that is more compact than the original binary data, making it easier to store or transmit.


import base64

data = b"SomeData"

encoded = base64.b64encode(data)

decoded = base64.b64decode(encoded)


Last updated