How Base64 Encoding Works
Base64 converts binary data into a string of 64 printable ASCII characters: A–Z, a–z, 0–9, +, and /. Every 3 bytes of input become 4 characters of output. If the input length is not divisible by 3, one or two = padding characters are appended to make the output length a multiple of 4.
The result is roughly 33% larger than the input. Base64 is not encryption — it is a reversible encoding. Anyone with the encoded string can recover the original bytes. It is used because many text protocols (HTTP headers, JSON, XML, email) cannot safely carry arbitrary binary bytes.