Base64 encoder & decoder

Paste any text and convert it to Base64, or paste a Base64 string and get the original text back. Accented characters and emoji are handled correctly (UTF-8).

The conversion happens in your browser: nothing is sent anywhere or stored.

What is Base64 encoding used for?

Base64 turns any sequence of bytes into text made up only of letters, digits, +, / and =. You'll run into it everywhere: images embedded in CSS and emails (data URIs), the Authorization: Basic header in HTTP requests, and the first two parts of a JWT. Keep in mind it is not encryption, anyone can decode it. Its only job is to carry binary data through channels that accept plain text.

Why UTF-8 support matters

The browser's built-in btoa() function fails on its own with accented letters, symbols like "€" and emoji, because it only accepts 8-bit characters. This tool first converts your text to UTF-8 bytes with TextEncoder, so strings like "café" and "🙂" encode and decode without errors, producing the exact same output you would get in Python or Node.js.

Base64 is not encryption

This is the commonest and the most dangerous misunderstanding: Base64 is a reversible encoding with no key, and anybody decodes it in a second. A token, a password or personal data «protected» with Base64 are in the clear for all practical purposes.

Its job is a different one: getting arbitrary bytes through a channel that only accepts text. It was born for email attachments, which can only carry printable characters, and that is why it now turns up in JSON, in URLs and inside HTML pages.

Why it takes a third more space

Base64 takes three bytes at a time and writes them as four characters: hence the 33% overhead, plus any padding with the «=» sign. It is a fixed and unavoidable cost, not a flaw in the implementation.

The practical arithmetic matters when embedding images in pages: a 300 kB photo becomes 400 kB of text inside the HTML, is not cached separately and is re-downloaded on every visit. It only makes sense for very small icons, where you save a network request.

The accent that breaks everything

The browser's btoa() works only on bytes up to 255, so it fails on any character outside basic Latin: an «è», an «ñ», an emoji or an ideogram. The error message talks about characters out of range, and says nothing at all about the real problem.

The correct solution is to convert the text to UTF-8 bytes first and then encode them, doing the reverse on the way back. It is why a string encoded by one program can come out unreadable in another: it is not Base64 that differs, it is the step from text to bytes.

Nearby tools

For images there is a dedicated page, Base64 to image. For web addresses, which need different encoding rules, look at URL encode and decode, and to check a file's integrity File checksum.