Base64
Base64 is an encoding wherein a binary file is converted into text characters each representing 6 bits, resulting in a best-case 4:3 size ratio to the original. The characters, which consist of
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/
are common to most text encodings and can generally pass between systems unmangled.
By word
A Base64-encoded message is, in essence, a string of 24-bit words encoded in 4 characters each representing 6 bits; specifically, the low 6 bits of the index of the character in the above alphabet.
For an arbitrary sequence of octets to be encoded, three octets at a time must be concatenated, big-endian, into a 24-bit word. For this to work out evenly, the number of octets in the stream must be a multiple of three. If it does not work out evenly, the final word is padded with nulls to three octets. Afterward, for each pad byte added, the rightmost 'A' in the final result word is replaced with '='.