Base64 Encoding Explained: What It Does and What It Does Not
Base64 makes data bigger, is not encryption, and is not compression. Here is a plain explanation of what Base64 actually does. Base64 is an encoding I encounter constantly, and it is also one of the most misunderstood. People use it to embed images in HTML, to send files in JSON, to store binary in text fields, and, mistakenly, to hide or protect data. Understanding what Base64 actually does clears up all of these uses and their common pitfalls. Here is a plain explanation of Base64 and how to use it well. What Base64 Actually Does Base64 converts binary data into text using a set of sixty-four characters: uppercase letters, lowercase letters, digits, and two symbols. Every three bytes of binary input become four characters of Base64 output. The encoding is reversible: the same algorithm that encodes can decode, with no key and no secret. Anyone with the Base64 string can recover the original bytes. The reason Base64 exists is that many systems are designed for text and break on raw binary. Email, JSON, XML, URLs, and many databases expect text. Binary data placed directly into these systems corrupts them, because certain byte values are treated as control characters. More tutorials are on the KitCraft Blog.