Start a project

Tool 42 of 57 · Encoding

Base64 & Data URI Encoder

Encode or decode Base64 text, including accents and emoji, or turn a small file into a data URI with the CSS and HTML to use it.

Base64 & Data URI Encoder at a glanceIllustration: 1, Text or a file; 2, processed in your browser; 3, Base64 + data URI.Base64 & Data URI Encoder1Text or a file</>3Base64 + data URI2In yourbrowser
1 Text or a file 2 processed on your device 3 Base64 + data URI

Base64 & Data URI Encoder

Text

Base64

01

What it does

Encodes and decodes Base64 with full UTF-8, and turns small files into data URIs with CSS and HTML.

  • Both directions, live
  • UTF-8 safe (£, é and emoji)
  • URL-safe Base64 for tokens and URLs
  • File to data URI with the right MIME type

02

Private by design

Everything happens in your browser. Nothing you type, paste or upload is sent anywhere, and it keeps working offline once the page has loaded.

03

What you get

Base64, a data URI, CSS and HTML, with a Copy and a Download button on every result.

  • Base64
  • Data URI
  • UTF-8

Why it matters

Base64 turns any data into plain text, which is how images get embedded in CSS, how email attachments travel and how many APIs pass tokens. The browser's built-in btoa() breaks on any character outside Latin-1, including £ and emoji.

This encoder handles UTF-8 properly, supports the URL-safe variant used by JWTs, and makes data URIs from files with the right type, plus a warning when a file is too big to be worth inlining.

How it works

  1. InputText or a small file
  2. In your browserUTF-8 bytes encoded, or decoded back
  3. OutputBase64, a data URI and ready CSS or HTML

Where it fits in a designer's workflow

  1. Plan
  2. Design
  3. Build
  4. Test
  5. Launch
Inlining tiny icons, or decoding values in APIs.

By the numbers

Base64 makes files about a third biggerjson.svg as SVG: 481 B; json.svg as Base64 data URI: 670 B, +39%; regex.svg as SVG: 534 B; regex.svg as Base64 data URI: 738 B, +38%; hash.svg as SVG: 422 B; hash.svg as Base64 data URI: 590 B, +40%json.svg as SVG481 Bjson.svg as Base64 data URI670 B, +39%regex.svg as SVG534 Bregex.svg as Base64 data URI738 B, +38%hash.svg as SVG422 Bhash.svg as Base64 data URI590 B, +40%
Measured with this site's own tool icons: Base64 turns every 3 bytes into 4 characters, plus the data: prefix. That's fine for a small icon, but large files are better as normal files the browser can cache. Source: RFC 4648: Base64.
Show the numbers as a table
IconSVGURL-encoded URIBase64 URI
json.svg481548670
regex.svg534607738
hash.svg422489590
time.svg515588714
uuid.svg545618754

How to use it

  1. For text, type in either box: the other updates.
  2. Tick URL-safe if the result goes in a URL or token.
  3. For a file, open the File tab and choose it.
  4. Copy or download the result.

FAQ

Is Base64 encryption?

No. Anyone can decode it. It's a way of writing data as text, not a way of hiding it.

When should I use a data URI?

For tiny assets, such as small icons under about 4 KB, to save a request. Larger files are better as normal files the browser can cache.

Why is Base64 bigger?

It uses 4 characters for every 3 bytes, so it's about 33% larger than the original.

Is my file uploaded?

No. It's read in your browser.

Work with me

Want a site that gets these right?

I build fast, accessible websites and web apps that pass these checks from day one. Tell me about your project and I'll reply personally with honest next steps.

All developer tools · Back to leej.uk