Base64 Encoder

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

Free Base64 encoder that turns any UTF-8 text into Base64, with an optional URL-safe variant. Runs entirely in your browser — nothing is uploaded. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

Does this support Unicode and emoji?

Yes. Input is encoded as UTF-8 bytes first, so accented characters, non-Latin scripts and emoji all encode correctly. This avoids the classic "Invalid character" error you get from calling btoa directly on non-Latin text.

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.

Standard vs URL-safe: when each matters

ScenarioUse standard Base64Use URL-safe Base64
Email MIME attachmentsYesNo
HTML data URI (src="data:...")YesNo
JWT header and payloadNoYes
Query-string parameterNoYes
File name or path segmentNoYes
HTTP cookie valueNoYes (safest)

Standard Base64 uses + and /, which have special meaning in URLs and query strings — + decodes as a space and / is a path separator. URL-safe Base64 swaps those for - and _, making the result safe to drop directly into a URL without percent-encoding. Padding (=) can also interfere with some URL parsers, which is why URL-safe Base64 typically omits it.

Common encoding mistakes to avoid

Encoding non-Latin text directly through btoa: Calling btoa("café") in JavaScript throws a DOMException because the French character é has a code point above 255. This tool encodes via UTF-8 bytes first, which is the correct approach and handles emoji and any non-ASCII script cleanly.

Treating Base64 as encryption: Base64 is encoding, not encryption. Anyone who can see the Base64 string can decode it instantly — it provides no confidentiality. Use it to represent binary data safely in text contexts, not to hide content.

Double-encoding: If you paste already-Base64-encoded text into this encoder, you get double-encoded output. Make sure you are starting from the original plaintext, not from an existing Base64 string.