Computers ultimately store everything โ text, images, audio, encrypted keys โ as raw binary bytes. The problem is that a lot of systems in the real world were built to reliably carry text, not arbitrary binary. Older email protocols guarantee delivery of 7-bit ASCII characters but can mangle raw binary bytes in transit. JSON and XML documents are text formats with no native way to embed a binary blob. URLs and many APIs expect readable characters, not arbitrary byte sequences that might contain control characters or invalid encodings.
Base64 solves this by converting any sequence of bytes into a string made up of only 64 safe, printable ASCII characters. Once your data is Base64 text, it can pass through any of those text-only systems without corruption โ the receiving end just decodes it back to the original bytes.
Base64 gets its name from its alphabet of exactly 64 characters: uppercase letters AโZ (26), lowercase letters aโz (26), digits 0โ9 (10), plus two more symbols โ typically + and / โ bringing the total to 64. Because 64 is a power of two (2โถ), each character can represent exactly 6 bits of data. The encoder takes your input 3 bytes (24 bits) at a time and repackages those 24 bits into 4 Base64 characters (4 ร 6 bits = 24 bits) โ which is also why Base64 output is always about 4/3 the size of the original input, roughly a 33% size increase.
=Since Base64 processes input in 3-byte chunks, what happens when the input length isn't a clean multiple of 3? The encoder pads the final group with one or two = characters to signal "these last bits are padding, not data." You'll see a single = when the input has one extra byte left over, and == when it has two. A Base64 string with no trailing = means the original input length was already a multiple of 3.
Let's encode the 5-character string Hello step by step:
01001000 01100101 01101100 (bytes for "Hel") and 01101100 01101111 (bytes for "lo" โ only 2 bytes left, so this group gets padded)Hello encodes to SGVsbG8=Notice the single trailing = โ that's because "Hello" is 5 bytes, which isn't a multiple of 3, so the last group needed one padding character. You can verify this instantly with the Base64 Encoder/Decoder โ paste in "Hello" and hit Encode.
data:image/png;base64,iVBORw0KG..., avoiding a separate HTTP request.header.payload.signature.Authorization: Basic ... header Base64-encodes the username:password pair (this is why Basic Auth requires HTTPS โ Base64 is trivially reversible).This is the single most important thing to understand about Base64: it provides zero security. It's a reversible text encoding, not a cipher โ anyone can decode Base64 back to the original data instantly, with no key or password needed. It's also not compression; encoded output is roughly 33% larger than the input, not smaller. Never rely on Base64 alone to protect sensitive data โ use real encryption (like AES) if security is the goal.
Encode or decode Base64 instantly, with full Unicode support for emoji and any language, entirely in your browser.
Open Base64 Tool โ