UTILS.
Private by default
⛓

Text to Data URI

Wrap text, CSS, SVG, HTML or JSON into a data: URI.

Your files stay on this device

Files are processed in your browser, never uploaded. The site downloads code and assets to run the tools. No accounts or trackers.

Use Download to save this tool as one HTML file for offline use.

Privacy →
output

About this tool

Turn text, markup or styles into a data: URI you can paste into HTML or CSS, using either Base64 or URL-encoding, all in your browser.

Choose a MIME type (text/plain, text/html, image/svg+xml, text/css or application/json). With Base64 on, the output is data:type;base64, plus the data; with it off, it is data:type, plus the text percent-encoded with encodeURIComponent. No charset parameter is added, and the result updates as you type.

Input is text only, so images and other binary files cannot be converted; SVG works because it is text. The page opens with <h1>Hello</h1> and text/html selected.

Frequently asked questions

Base64 or URL-encoded — which should I pick?
Base64 is the most compatible everywhere; URL-encoding keeps text readable and is often smaller for SVG and CSS.
Does it handle non-ASCII text?
Yes — text is encoded as UTF-8 before Base64, so emoji and accented characters round-trip correctly.
Can I convert an image file?
No. The input is a text box, so only text such as SVG, HTML, CSS or JSON can be encoded.
What is escaped when Base64 is off?
Everything encodeURIComponent escapes, including spaces, quotes, angle brackets, # and line breaks.

More tools