Skip to content
Utilboxes

Base64 Encoder

Encode text or a file to Base64. Supports URL-safe output and can produce a complete data URI.

Runs entirely in your browser

How to use the Base64 Encoder

  1. 1Paste text, or drop in a file.
  2. 2Choose standard or URL-safe encoding.
  3. 3For files, optionally produce a full data URI with the correct MIME type.
  4. 4Copy the result or download it.

How it works

Base64 represents binary data using 64 printable ASCII characters, taking three bytes at a time and rewriting them as four characters. The cost is size: output is always about 33% larger than the input. The benefit is that the data survives transport through systems that only handle text — email bodies, JSON strings, HTTP headers, URLs.

Unicode needs care. The browser's btoa() only accepts bytes, so passing it a string with an accented character or an emoji throws an error. Text here is encoded to UTF-8 bytes first, which is why 'café' and '日本語' encode correctly rather than failing.

URL-safe encoding swaps + and / for - and _, because the standard characters have their own meaning in a URL and would otherwise need percent-encoding on top. Padding is usually dropped in this variant.

Base64 is an encoding, not encryption. Anyone can decode it instantly. It hides nothing.

Everything runs in this page. Nothing you paste is transmitted, logged or stored, which is what makes it safe to drop a production payload in here while you are debugging.

Frequently asked questions

Is Base64 encryption?
No. It is a reversible encoding with no key and no secret. Anyone who has the string can decode it in a second. Never use it to protect anything.
Why is my encoded text larger?
Base64 turns every three bytes into four characters, so output is roughly 33% larger. That is inherent to the encoding.
When should I use URL-safe encoding?
Whenever the result goes into a URL path, query string or filename, since + and / have special meanings there.
What is a data URI?
A complete inline resource — data:image/png;base64,… — that embeds a file directly in HTML or CSS. It removes a network request at the cost of a larger document.