Base64
Description:
Base64 is a group of similar binary-to-text encoding schemes that represent binary data in ASCII string format by translating it into a radix-64 representation.
The term Base64 originates from a specific MIME content transfer encoding.
Each base64 digit represents exactly 6 bits of data. Thus, three 8-bit bytes (i.e. total 24 bits) can be represented by four 6-bit base64 digits.
A certain set of 64 characters chosen to represent the 64 place-values for the base varies between implementations. The overall strategy is to choose 64 characters, which are members of a subset common to most encodings, as well as printable. This combination leaves the data unlikely to be modified when transmitting through information systems such as e-mail, which have not traditionally been 8-bit clean. For example, the Base64 MIME implementation uses A - Z, A-z, and 0-9 for the first 62 values. Other variants share this property, but differ in the characters selected for the last two values; an example is UTF-7.
The earliest instances of this type of encoding were created for dial-up communication between systems running the same OS — for example, UUENCODE for UNIX, BinHex for the TRS-80 (later adapted for the Macintosh) — and could therefore make more assumptions about what characters were safe to use. For example, uuencode uses uppercase letters, numbers, and many punctuation marks, but not lowercase.
Each base64 digit represents exactly 6 bits of data. Thus, three 8-bit bytes (i.e. total 24 bits) can be represented by four 6-bit base64 digits.
A certain set of 64 characters chosen to represent the 64 place-values for the base varies between implementations. The overall strategy is to choose 64 characters, which are members of a subset common to most encodings, as well as printable. This combination leaves the data unlikely to be modified when transmitting through information systems such as e-mail, which have not traditionally been 8-bit clean. For example, the Base64 MIME implementation uses A - Z, A-z, and 0-9 for the first 62 values. Other variants share this property, but differ in the characters selected for the last two values; an example is UTF-7.
The earliest instances of this type of encoding were created for dial-up communication between systems running the same OS — for example, UUENCODE for UNIX, BinHex for the TRS-80 (later adapted for the Macintosh) — and could therefore make more assumptions about what characters were safe to use. For example, uuencode uses uppercase letters, numbers, and many punctuation marks, but not lowercase.
Resources: