Skip to content
← Back

Data URI Generator - Online File to Base64 Converter

Text
Runs locally · Not uploaded

Free online Data URI generator tool supporting file and text to data: protocol URL conversion with both Base64 and URL encoding options.

Was this result helpful?

For local tools, open DevTools → Network and search your input — it should not appear in requests.

Usage Guide

Build data URIs from files or text with base64 or percent-encoding — local.

1. How

File MIME comes from the file; text MIME is editable.

  1. File or text mode.
  2. Set MIME and encoding.
  3. Copy the data URI.

2. When it pays

  • Tiny assets.
  • Avoid huge inlines.
  • SVG often prefers percent-encoding.
  • Email clients block remote images.

3. Encoding choice

Base64 for binary; percent-encoding for text; encode hash in SVG.

4. Cache tradeoffs

  • Inlines bust page cache.
  • Bundlers auto-inline under a budget.
  • Check output length.

5. Pair tools

Use Base64 tools for raw strings; compress images first.

6. Safety

Local only — still treat content as sensitive when it is.

  • No secrets in public repos.
  • CSP may block script URIs.
  • Do not paste untrusted URIs.

7. Reminder

Inline is a trade: fewer requests, worse cache granularity.

FAQ

No — encoding is fully local, so unreleased assets are fine here. Where the generated URI ends up, and who sees it, still deserves your attention.

Text mode and file mode: text mode takes any text with an editable media type (text, vector graphics, scripts); file mode accepts drag & drop and detects the type from the file itself. After switching the encoding, regenerate before copying.

Base64 suits binary data like bitmaps and fonts, adding roughly 33% in size; percent-encoding suits text resources (SVG, style snippets) and preserves semantics better. Classic inline-SVG pitfall: the hash character must be encoded, or the stylesheet treats everything after it as an anchor. If you need a bare Base64 string without the data: prefix, use the Base64 tool instead.

Resources of a few KB benefit most: fewer requests and a snappier first paint. Beyond roughly 10 KB it usually backfires — base64 adds about a third to the size and oversized inlines slow parsing. Inlined resources cannot be cached separately either, so changing one icon invalidates the cache for the whole page. Glance at the output length before copying: abnormal bloat usually means the wrong encoding or an oversized image; compress or convert images first to shorten the URI.

Many email clients block external images by default, so inlining them as data URIs is the reliable way to get them shown — one of the most classic uses of this format.

Never commit key-bearing configuration as data URIs to a public repository; inline script URIs get blocked under some content security policies, so check the site policy first; and never paste an unknown data URI into a production page without confirming its media type and content.

Related Tools

Related Articles