What Is Base64 Encoding? A Complete Guide
Base64 is a method for representing binary data using only 64 printable ASCII characters: the uppercase letters A to Z, the lowercase letters a to z, the digits 0 to 9, and two extra symbols (+ and / in standard Base64). It was created so that binary data, such as images, files or raw bytes, can be safely transmitted through systems that were designed to handle text only, like email, JSON, XML and URLs. Without an encoding like Base64, raw binary bytes can be corrupted or misinterpreted when they pass through text-based channels.
The name comes from the fact that the scheme uses a base of 64 values. Base64 works by taking three bytes of input (24 bits) and splitting them into four groups of six bits each. Because six bits can represent 64 different values (2 to the power of 6), each group maps neatly to one of the 64 characters in the Base64 alphabet. When the input length is not a multiple of three, the output is padded with one or two equals signs (=) so the result is always a multiple of four characters long.
A side effect of this three-to-four expansion is that Base64-encoded data is roughly 33% larger than the original. This is the trade-off you accept in exchange for being able to move binary data safely through text-only systems. The TOOLBeans encoder shows you this size change live, so you can see exactly how much larger your encoded output is than the original input.