Base64 Encode & Decode
Encode text to Base64 or decode Base64 to text in the browser: UTF-8 made explicit, standard or URL-safe alphabet, padding, MIME wrapping, errors with position.
The Base64 string for any text (or the text for any Base64), byte and character counts, the alphabet and padding used, and — when the data is not text — a hex view instead of garbled characters.
Example: "héllo €" is 7 characters but 10 UTF-8 bytes and encodes to aMOpbGxvIOKCrA==; /w== decodes to the single byte 0xFF, reported as binary rather than as "�".
Six bits at a time,
bytes made explicit.
What Base64 actually encodes, why the text-to-bytes step matters, the two alphabets and the padding rules, and what happens when the decoded bytes are not text.
Bytes, not characters
Base64 encodes bytes: every 3 bytes become 4 characters from a 64-symbol alphabet (RFC 4648 §4), so the output is 4⁄3 the size. Text has to become bytes first, and that step is where tools silently disagree — this page always uses UTF-8 (RFC 3629) and shows the byte count next to the character count, so "héllo €" is visibly 7 characters and 10 bytes. A system expecting Latin-1 or UTF-16 will decode different text from the same Base64.
Alphabets, padding and line length
The standard alphabet ends in + and /; the URL- and filename-safe one (§5) uses - and _ instead, and is what JWTs and most URL parameters expect — usually without the = padding, which is only there to make the length a multiple of four. MIME (RFC 2045) wraps encoded lines at 76 characters with CRLF; decoders must ignore that whitespace, and this one does.
Decoding strictly, reporting clearly
The decoder is written here rather than borrowed from the browser so that an invalid character, a 4n + 1 length, data after the padding or non-zero trailing bits are reported at their position instead of producing garbage or nothing. Both alphabets are accepted on input and noted. If the decoded bytes are not valid UTF-8 — an image, a key, a compressed file, or text in another encoding — the page says so and shows the bytes as hex rather than replacing them with "�".
What the tool does not do
Base64 is not encryption or compression; anyone can decode it and it makes data larger. File encoding (images to data URIs) and other encodings (Base32, Base16/hex as input) are separate tasks. Inputs up to 4 MB are processed on your own machine; nothing is uploaded. The same four anonymous usage counts as the rest of the site apply.
SOURCES
- RFC 4648 — The Base16, Base32, and Base64 Data Encodings
- RFC 3629 — UTF-8, a transformation format of ISO 10646
- RFC 2045 §6.8 — Base64 Content-Transfer-Encoding (76-character lines)
Last reviewed 18 September 2026. How results are checked: How we verify.