Skip to content
Codoryn Search tools

Base64 Encoder & Decoder

Convert text to Base64 and back, with correct UTF-8 handling and strict validation.

What Base64 does

Base64 represents binary data using 64 safe ASCII characters, so bytes can travel through channels that only handle text — data URLs, JSON fields, email bodies, HTTP headers.

It groups three bytes into four characters, which makes the output about 33% larger than the input. The trailing = characters are padding that indicates how many bytes the final group really carried.

Base64 is not encryption. Anyone can decode it. It is an encoding for safe transport, never a way to protect a secret.

How to use it

  1. Choose Text to Base64 or Base64 to text. The mode is always explicit — Codoryn never guesses from your input.
  2. Paste your content. Results update as you type below 256 KB; larger inputs run when you press Run or Ctrl/Cmd + Enter.
  3. Turn on URL-safe alphabet when the value must survive inside a URL or filename.

Unicode is handled correctly

Base64 encodes bytes, not characters, so text must first become bytes. Codoryn always uses UTF-8.

This matters because the browser's built-in btoa throws on any character above U+00FF — it cannot encode café, Japanese text, or an emoji without a conversion layer. Codoryn converts to UTF-8 first, so é encodes as w6k= and a rocket emoji as 8J+agA==, and both decode back exactly.

The URL-safe alphabet

Standard Base64 uses + and /, which both have meaning inside URLs. The URL-safe variant defined in RFC 4648 §5 substitutes - and _ in their place; everything else is identical.

The alphabets are not interchangeable. Decoding a URL-safe value with the standard alphabet selected is reported as an error rather than silently producing wrong bytes, so make sure the toggle matches the value you have.

What counts as invalid

Decoding is strict, and the rules are fixed rather than best-effort:

  • Whitespace — spaces, tabs, carriage returns, line feeds and form feeds are ignored, so wrapped Base64 pasted from an email or a certificate decodes cleanly. No other character is skipped.
  • Alphabet — any character outside the selected alphabet is an error, reported with its exact position.
  • Padding — = may appear only as one or two trailing characters, and only when the length is a multiple of four. Unpadded input is accepted unless its length is impossible.
  • Not text — if the bytes decode successfully but are not valid UTF-8, that is reported plainly. This version is text-only, so it will not show you a page of replacement characters and call it a result.

Frequently asked questions

Does my data leave the browser?

No. Both directions run in your browser, and this tool does not send your input over the network.

Can I decode an image or a PDF?

Not in this version. It is built and tested for UTF-8 text. Binary and file handling need their own tool with its own download behaviour and tests, rather than being approximated here.

Why does my Base64 end in = or ==?

Padding. One = means the last group held two bytes; two means it held one. It is normal and expected.

Is there a size limit?

Inputs above 10 MB are refused in this version.