What is Base64? Encoding Explained
Base64 is a method of encoding binary data into text format using a set of 64 characters, including 26 uppercase letters, 26 lowercase letters, numbers 0-9, and two special characters “+” and “/”. It works by grouping input binary data into sets of 6 bits, and converting each group into its corresponding Base64 character.
Base64 encoding is commonly used for transmitting or storing binary data in text protocols, such as sending attachments in emails or embedding images in webpages. Because Base64 encoding only contains printable characters, it can be transmitted in environments that do not support binary data.
When using Base64 encoding, binary data consisting of every 3 bytes is divided into 4 groups, each group containing 6 bits. If the initial data is not a multiple of 3, some padding is applied. Afterwards, the value of each group’s 6 bits is mapped to the corresponding character in the Base64 character table, creating the encoded string.
One characteristic of Base64 encoding is that the length of the encoded data will increase by about 1/3 compared to the original data, because every 3 bytes of data are encoded into 4 characters. Additionally, Base64 encoding does not provide encryption, it is simply a way to convert binary data into text.