Skip to content
SUMILORASUMILORA

Base64 encoder and decoder

Developer tools

Paste text to encode, or Base64 to decode. The direction switches automatically.

Runs in your browser

Nothing is uploaded. The work happens on your own device, so your file or text never reaches us.

About this tool

Base64 is not encryption

It is an encoding: a way of writing arbitrary bytes using 64 printable characters, so they survive being put in a URL, an email header or a JSON string.

It is trivially reversible by anybody, with no key. A password or a token in Base64 is a password in plain text with an extra step. If you need secrecy, you need encryption.

Why so many Base64 tools break on "café"

btoa throws on any character above U+00FF, so naive tools fail on accented text, Arabic, Japanese and every emoji.

The fix is to encode the text as UTF-8 bytes first and Base64 those bytes, which is what this does. Encoding and decoding round-trip exactly for any text in any script.

URL-safe Base64

Standard Base64 uses + and /, which both have meaning in a URL, and pads with =, which has meaning in a query string.

The URL-safe variant (RFC 4648 §5) substitutes - and _ and drops the padding. JSON Web Tokens use it, which is why a JWT contains no plus signs. The decoder here accepts both and restores the padding itself.

Questions

Is Base64 secure?

Not at all. It is an encoding, reversible by anyone without a key. Never use it to protect anything.

Why does my Base64 string fail to decode?

Usually a length that the encoding cannot produce, a character outside the alphabet, or bytes that are not valid UTF-8 text — which means it is binary data rather than text. The message above says which.

Why does Base64 make data bigger?

It writes 3 bytes as 4 characters, so the output is about 33% larger. That is the cost of using only printable characters.

Related tools