ToolBench

Data

Base64 Encoder & Decoder

Handles UTF-8 properly, so accented letters, Chinese characters and emoji survive the round trip — unlike scripts that call btoa on raw text.

Result appears here.

How to use it

  1. Paste the text you want to encode, or a Base64 string you want to read.
  2. Press Encode for text → Base64, or Decode for the reverse.
  3. Copy the result with the button above.

Base64 is not encryption

It is a transport encoding: three bytes become four ASCII characters so that binary data can pass through channels that only accept text, such as email bodies and JSON fields. Anyone can decode it with a single library call and no key at all. Encoding a password or an API key as Base64 hides it from a casual glance and from nothing else.

Why the output is about a third larger

Sixty-four symbols carry six bits each, so four characters encode 24 bits — exactly three bytes. The ratio is fixed at 4:3, plus padding and line breaks. That is why inlining an image as a data URI costs roughly 33% more bytes, and why Base64 is a poor choice for large payloads when a binary transfer is available.

Data URLs, PEM files and line breaks

Base64 has two incompatible conventions and mixing them breaks things quietly. MIME (email attachments, PEM certificates) wraps output at 76 characters; most programming languages do not wrap at all. A certificate pasted with the wrong wrapping will be rejected by the tool that reads it even though every character is correct.

For data URLs the wrapping must be absent, and the MIME type has to match the actual bytes: data:image/png;base64, in front of a JPEG still renders in most browsers, which means the mistake only shows up later, in a system that trusts the declared type.

Frequently asked questions

Why do some Base64 strings end with = signs?

Base64 works in groups of three bytes. Leftover bytes are padded with = so the output length stays a multiple of four.

Does Base64 encrypt anything?

No. It is a transport encoding, not encryption — anyone can decode it instantly.

Why does my Chinese text turn into garbage elsewhere?

Those tools treat input as Latin-1. This one converts to UTF-8 bytes first, which is why the result round-trips correctly.

Can I decode Base64 back to a file?

Decoding gives you the original bytes, but only if you know the format. Without the MIME type in front, a decoded image has no extension and no way to be opened.

Why does my Base64 end with one or two equals signs?

Base64 works in blocks of three bytes. One leftover byte is padded with two =, two leftovers with one. The padding is what keeps the length a multiple of four.