Base64 Encoder / Decoder
Encode and decode Base64 with correct UTF-8 handling and a URL-safe option.
Text
Base64
About this Base64 encoder and decoder
Base64 represents arbitrary bytes using only 64 printable characters, so binary data can travel through channels that expect text — email bodies, JSON fields, data URIs, HTTP headers. It is an encoding, not encryption: anyone can decode it, so never use it to hide anything.
Unicode is handled correctly
The browser's built-in btoa only handles Latin-1 — it throws on café and silently corrupts anything above U+00FF. This tool encodes your text to UTF-8 first, so accented characters, CJK text and emoji all survive a round trip. That is the same thing every server-side Base64 implementation does.
Standard or URL-safe?
Standard Base64 uses + and /, which both have meaning inside a URL and get mangled when they appear in a query string or path. The URL-safe alphabet (RFC 4648 §5) swaps them for - and _. Use URL-safe for anything that travels in a URL, a filename, or a JWT — everything else can use standard.
What is the padding for?
Base64 works in groups of three bytes. When the input does not divide evenly, = characters pad the final group so the length is always a multiple of four. Some formats require it, others forbid it — JWTs, for example, drop it. Decoding here works either way.
Why did my decode fail?
The usual causes are a truncated string (its length leaves a remainder that cannot encode any byte), a character from the other alphabet, or text that was Base64 of binary rather than of text. That last case is reported separately: the Base64 itself is valid, but the bytes it produces are not UTF-8 — typically an image or an archive rather than something readable.