Base64 Encoder & Decoder — UTF-8 Safe

100% freeRuns in your browserNo sign-up

About the Base64 Encoder / Decoder

Base64 represents binary data using 64 safe ASCII characters, which is how emails attach files, JSON carries binary blobs and data-URI images embed in CSS. This tool encodes text to Base64 and decodes it back, correctly handling multi-byte UTF-8 characters and emoji.

A URL-safe mode swaps + and / for - and _ for use in query strings, JWTs and filenames. As always, nothing is sent to a server — the conversion is pure in-browser JavaScript.

How to use the Base64 Encoder / Decoder

  1. Paste text into the top box and click Encode, or paste Base64 into the bottom box and click Decode.
  2. Toggle URL-safe mode if the result goes into a URL, JWT or filename.
  3. Copy the result with one click.

How Base64 works

Input bytes are grouped in threes (24 bits) and split into four 6-bit values, each mapped to A–Z, a–z, 0–9, + and /. Padding "=" fills the final group. Output length is always a multiple of 4, and 3 bytes become 4 characters (a 33% size overhead).

Frequently asked questions

Is Base64 encryption?

No. Base64 is an encoding, not encryption — anyone can decode it instantly. Never use it to protect secrets.

Why do some Base64 strings contain - and _ instead of + and /?

That is the URL-safe alphabet (RFC 4648 §5), which avoids characters with special meaning in URLs and file systems. Toggle it on for JWTs and query strings.

Can it decode Base64 that contains line breaks?

Yes — whitespace and line breaks are ignored during decoding, so copy-pasted MIME blocks decode fine.

Related tools