Base64 Encoder

Encode text to Base64 or URL-safe Base64, with Arabic and emoji handled as UTF-8.

How to use

What it checks and how it works

The text becomes bytes through UTF-8 (RFC 3629), and then every three bytes are written as four characters from the Base64 alphabet of RFC 4648, with = padding at the end. The URL-safe option uses the alphabet of RFC 4648 section 5, where - and _ replace + and /. Because the encoder works on UTF-8 bytes, Arabic text encodes correctly where the browser's plain btoa function would fail. Base64 is an encoding, not encryption: anyone can decode it, so never use it to hide a password or a token. It makes data about a third larger.

Is Base64 secure?

No. It only changes how bytes are written, and anyone can decode it. Use encryption if the content must stay secret.

Why does btoa fail on Arabic text?

The browser's btoa accepts only Latin-1 characters. This tool converts the text to UTF-8 bytes first, so Arabic and emoji encode without errors.

When do I need the URL-safe version?

When the result goes into a URL, a filename or a JWT, where + and / have special meaning. The URL-safe alphabet uses - and _ instead, and padding is often dropped.

Sources

Related tools

Privacy

Runs in your browser; nothing is uploaded. The interactive tool needs JavaScript.