Base64 Encoder

Encode text to Base64 — standard or URL-safe — in your browser.

Ad placeholder (leaderboard)
Enjoying the tools? Go Pro for £4.99 (one-time) and remove all ads — forever, on this device. Remove ads — £4.99

Base64 encoder

This tool converts any UTF-8 text to Base64, with an optional URL-safe variant. It’s useful for embedding text in data URIs, building API payloads, constructing JWT-style segments, or any system that only accepts ASCII. Encoding runs entirely in your browser, so it’s safe for sensitive input.

How it works

The text is first turned into UTF-8 bytes with new TextEncoder().encode(text). Those bytes are assembled into a binary string and passed to the browser’s native btoa(), which produces standard Base64. Encoding via UTF-8 bytes first (rather than calling btoa on the raw string) is what lets emoji and non-Latin characters encode without errors. When URL-safe is on, the result is post-processed: + becomes -, / becomes _, and trailing = padding is stripped — the RFC 4648 URL-safe alphabet.

Example

InputStandard Base64URL-safe
HelloSGVsbG8=SGVsbG8
a+b/cYStiL2M=YStiL2M
café ☕Y2Fmw6kg4piVY2Fmw6kg4piV

Base64 grows the data by about one third (3 bytes become 4 characters), so Hello (5 bytes) becomes 8 characters before padding.

To reverse the process, use the Base64 decoder. Everything runs locally in your browser — nothing is uploaded.

Ad placeholder (rectangle)