Advertisement

Data URI Converter

Turn any file into a data URI (base64) for embedding in code, or decode a data URI back to a file. Free, instant.

Encode a file

Choose a file to get its data URI.

Decode a data URI

Paste a data URI to download it as a file.

Data URI output

Choose a file to encode it.

Advertisement

How encoding works

The browser's FileReader reads your file and returns a data URI: the MIME type, a base64 marker, and the base64-encoded bytes. That string can be pasted directly into an img src, a CSS url(), or any API that accepts inline data. Decoding reverses the process back into a downloadable file.

The 33% size cost

Base64 inflates data by about one third, so data URIs suit small assets like icons and tiny images. Large files bloat your HTML and block rendering; keep those as separate files and link them normally.

Data URI Converter FAQs

When should I use a data URI?
For tiny images, icons and fonts where avoiding an extra HTTP request matters more than the size overhead. A common rule of thumb is under 2-4 KB.
Why is the output so much longer than my file?
Base64 represents every 3 bytes as 4 characters, adding roughly 33% overhead plus the data: prefix. That is the inherent cost of text-safe encoding.
Can I decode a non-base64 data URI?
Yes. The decoder handles both base64 and URL-encoded data URIs, detecting the format from the URI itself.
What filename does the decoded file get?
Whatever you type in the filename box. Add the right extension yourself (like .png) since the data URI does not always carry one.
Is there a size limit?
Only your device's memory. Multi-megabyte files encode fine, though the resulting string can make the page sluggish when displayed.
Advertisement