Base64 encoding is a way of Data representation binary data in a text-only form.

Base64 originates from a specific MIME content transfer encoding. Each Base64 digit represents exactly 6 bits of data. Three 8-bit bytes (i.e., a total of 24 bits) can therefore be represented by four 6-bit Base64 digits.

Base64 is commonly used in LDIF for values containing non-ASCII characters, or for values that could otherwise be ambiguous (e.g., values that begin or end with spaces).

Base64 is also frequently used to encode certificate contents or the output of message digests like MD5 or SHA.

The Base64 encoding is described in RFC 4648.

The basic principle of Base64 encoding is that it defines a 64-byte alphabet containing the following characters in the given order:


Each of those characters is assigned a numeric value between 0 and 63 based on its position in the list (i.e., "A" is 0, "B" is 1, "C" is 2, ... "+" is 62, and "/" is 63). A value is broken up into six-bit segments, and each of those six bits is converted into a numeric value between 0 and 63 and replaced with the specified character from the alphabet given above. This means that every three bytes of a binary value is converted into four characters from the Base64 alphabet. If the length of the binary value is not a multiple of three bytes, then it is zero-padded and either one or two equal signs are appended to the Base64-encoded value.

Base64 is an Encoding and is not a hash nor is it a form of Encryption

More Information#

There might be more information for this subject on one of the following: