Developer ToolsUnicode-safe

Base64 Encoder & Decoder

Convert text to Base64 and back. Unicode is handled correctly, URL-safe output is one click away, and missing padding on a truncated string is repaired automatically.

Text or Base64

Everything is processed in your browser — nothing is uploaded.

0 characters
STATUS
Waiting for input
Pick a direction and paste your text.
Input size
Output size
Size change
Padding characters
Share & embed

Base64 is encoding, not encryption

This needs saying because the mistake is common and expensive: Base64 provides no confidentiality whatsoever. Anyone can decode it instantly, including this page. It exists to move binary data safely through channels that only accept text — email bodies, JSON fields, HTML attributes, URLs. Putting a password in Base64 protects nothing.

The Unicode trap

The browser's native btoa function throws an error on any character above code point 255, so naive implementations break on accented Latin, Vietnamese, Chinese or emoji. The correct approach encodes the text as UTF-8 bytes first and then Base64-encodes those bytes. This page does that, so "Xin chào" and "🎯" round-trip cleanly instead of failing.

Standard versus URL-safe

Standard Base64 uses + and /, both of which have reserved meanings in URLs — + is often read as a space in query strings. The URL-safe variant defined in RFC 4648 substitutes - and _ and usually drops the trailing = padding. JSON Web Tokens use this variant, which is why a JWT never contains a plus sign.

Why the output is about a third larger

Base64 packs every three bytes into four printable characters, so encoded data is roughly 133 percent of the original size, plus padding. That overhead is the price of text safety. Embedding a large image as a data URI in a stylesheet is convenient but makes the file a third bigger and blocks it from being cached separately.

Frequently Asked Questions

Is Base64 a form of encryption?
No. It is a reversible encoding with no key and no secrecy. Anyone can decode it in a second. It exists to carry binary data through text-only channels, not to hide anything.
Why do some tools fail on accented or non-Latin text?
Because the browser's btoa function only accepts characters below code point 256. The text has to be converted to UTF-8 bytes first. This page does that, so Vietnamese, Chinese and emoji all encode and decode correctly.
What is URL-safe Base64?
A variant from RFC 4648 that replaces + with - and / with _, and usually omits the = padding, so the result can be placed in a URL without escaping. JSON Web Tokens use this variant.
Why is the encoded text longer than the original?
Base64 turns every three bytes into four characters, so output is about one third larger, plus up to two padding characters. That overhead is inherent to the format.