— Data URI Generator

Free Data URI Generator

Quick Tips

  • This tool runs entirely in your browser - your data stays private.
  • Press Ctrl+V (Cmd+V on Mac) to quickly paste text.
  • Use the Copy button to save your result to clipboard.
  • Bookmark this page for quick access!

Convert files and text to Data URI format for embedding in HTML and CSS.

Your Recent Tools

Examples

Input
Hello, World!
Output
data:text/plain;base64,SGVsbG8sIFdvcmxkIQ==
Input
<svg xmlns="http://www.w3.org/2000/svg"><circle r="10"/></svg>
Output
data:image/svg+xml;base64,PHN2ZyB4bWxucz0ia...
Input
{"key":"value"}
Output
data:application/json;base64,eyJrZXkiOiJ2YWx1ZSJ9

Why Use This Tool?

What problems does this solve?

External file requests add latency to page loads. For small assets, the HTTP overhead exceeds the actual data transfer time. Data URIs eliminate these requests by embedding content directly, improving perceived performance.

Common use cases:

  • Embedding small icons and logos in CSS for single-request stylesheets
  • Creating self-contained HTML files with embedded images
  • Building email templates where external images might be blocked
  • Reducing requests for critical above-the-fold content
  • Embedding small fonts or SVG graphics inline

Who benefits from this tool?

Frontend developers optimizing page load performance. Email developers working around image blocking. DevOps engineers creating self-contained deployments. Anyone reducing HTTP request count.

Privacy first: All conversion happens locally in your browser. Your files are never uploaded to any server.

Frequently Asked Questions

There is no official limit in the specification. Browsers typically handle at least 2MB, but performance degrades with large URIs. Best practice is to keep Data URIs under 10KB for optimal performance.

You can, but should not. Base64 increases size by 33%, and large Data URIs hurt page load times. They cannot be cached separately from the document. Use external files for images over 10KB.

No, Data URIs are not cached separately. They are cached as part of the containing document (HTML, CSS, JS). This is why they are inefficient for large or frequently-used assets.

Base64 encoding makes binary data safe for inclusion in text-based formats like HTML and CSS. Without encoding, binary data could contain invalid characters. Plain text can use URL encoding instead.

Yes, Data URIs work perfectly in CSS background-image, list-style-image, and @font-face src. This is one of their most common uses - embedding small icons directly in stylesheets.

Read the image file as binary, Base64-encode it, and prepend the data URI prefix with the correct MIME type (like image/png or image/jpeg). This tool automates the process for you.