Base64 Converter
Encode and decode Base64 instantly. Fully in your browser.
Encode and decode Base64 in both directions, with correct UTF-8 handling — the case where the browser's built-in btoa silently corrupts accented characters and emoji.
Base64 is encoding, not encryption
Base64 maps binary data onto 64 printable characters so it can survive transport through systems that only handle text: email bodies, JSON strings, HTTP headers, data URIs. Anyone can reverse it in one step. It provides zero confidentiality.
The encoding costs about 33 percent in size, since three bytes become four characters. Padding with equals signs brings the output up to a multiple of four characters, and some decoders reject input without it.
The UTF-8 trap
The browser function btoa only accepts characters in the Latin-1 range. Pass it a string with an accent, a Chinese character or an emoji and it throws InvalidCharacterError. Many quick Base64 tools inherit that limitation, which is why people conclude Base64 cannot handle Unicode.
The correct approach is to encode the string to UTF-8 bytes first, then Base64 those bytes. This tool does that, so round-tripping non-ASCII text gives back exactly what you put in.
Base64 versus base64url
Standard Base64 uses plus and slash, both of which have meaning inside a URL. The URL-safe variant, base64url, swaps them for hyphen and underscore and drops the padding. JWT segments, file names and anything embedded in a query string use base64url.
If you decode a JWT segment with a standard Base64 tool and get garbage, the cause is almost always this difference. Swapping the two characters back is usually enough to make it readable.
Frequently asked questions
- Can I decode a Base64 image here?
- You can decode a data URI to inspect its contents, but this tool is built for text. For binary output, decode the string in a script rather than pasting it into a text box.
- Why does my decoded text look like question marks?
- The original bytes were probably not UTF-8 — a legacy Windows-1252 or GBK file, for example. Base64 preserved the bytes faithfully; the interpretation is what differs.
- Is anything uploaded?
- No. Encoding and decoding both use browser APIs on data already in the page.