- Dividing:Base64 encoding operates on 8-bit units, so the binary data is divided into groups of three bytes (24 bits).
- Converting: Converting the three bytes into a 24-bit binary number. Each group of three bytes is combined into a 24-bit binary number.
- Splitting: Splitting the 24-bit binary number into four 6-bit units.The 24-bit binary number is split into four 6-bit units. These 6-bit units form the indices for selecting characters from the Base64 character set.
- Mapping: Each 6-bit unit is treated as an index value, and the corresponding character from the Base64 character set is selected. The Base64 character set consists of 64 characters, typically comprising uppercase letters (A-Z), lowercase letters (a-z), numbers (0-9), and two additional characters, such as '+' and '/'. These characters are used to represent the binary data.
The following table shows the mapping from binary data to Base64 characters:
| Byte | Base64 Character |
| 0000 | A |
| 0001 | B |
| 0010 | C |
| 0011 | D |
| 0100 | E |
| 0101 | F |
| 0110 | G |
| 0111 | H |
| 1000 | I |
| 1001 | J |
| 1010 | K |
| 1011 | L |
| 1100 | M |
| 1101 | N |
| 1110 | O |
| 1111 | P |
Some additional details about Base64 encoding:
- Base64 encoding increases the size of the data by 33%. This is because each group of 3 bytes is converted into 4 characters of text.
- Base64 encoding is not secure.