Base64 Character Encoding

The Base64 is a binary-to-text encoding that represents binary data in an ASCII string format by translating it into a radix-64 representation. Each Base64 digit represents exactly 6 bits of data. Therefore, three 8-bit bytes (total of 24 bits) can be represented by four 6-bit Base64 digits.

images/webmaster/base64-character-encoding.jpg

The particular set of 64 characters chosen to represent the 64 place-values for the base varies between implementations. For example, MIME's Base64 implementation uses A–Z, a–z, and 0–9 for the first 62 values. 

Base64 encoding converts three octets into four encoded characters. Padding characters (represented by "=" sign) might be added to make the last encoded block contain four Base64 characters.