Skip to content
Utilboxes

Base64 Encoder

Paste text or drop in a file to encode it as Base64, in standard or URL-safe form, or as a complete data URI with the right MIME type. Unicode such as 'café' encodes correctly via UTF-8, and the output is about 33% larger than the input. Base64 is an encoding, not encryption. Nothing is uploaded.

Runs entirely in your browser

Updated

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.

Tips and common mistakes

  • Never use Base64 to hide secrets; anyone can decode it instantly.
  • Embed only small images as data URIs; large ones bloat HTML and CSS and cannot be cached separately.
  • Choose URL-safe encoding for values that go into URLs, cookies or tokens.
  • Expect the output to be about a third larger than the input.

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.
How do I put an image directly into HTML or CSS?
Encode the image file with the data URI option. The result can go in an img src attribute or a CSS url() value.
Why do accented characters fail in other encoders?
The browser's basic btoa() function only accepts single bytes. Text here is converted to UTF-8 first, so accented letters and emoji encode correctly.
Is my file uploaded?
No. Text and files are encoded in your browser.

Guides