Convert Text to Data URI Online Free Tool

Convert Text to Data URIs - choose MIME (text, HTML, CSS, JSON, SVG), URL-encoded or Base64. Free, client-side, instant, offline.

Wrap any text — plain, HTML, CSS, JSON, or SVG — into a data: URI, ready to drop into <img src>, background-image: url(), <iframe>, or an API request.

How to Use Convert Text to Data URI Online Free Tool

  1. Paste your payload - text, HTML, CSS, JSON, XML, Markdown, or SVG. The output recomputes within 150 ms of your last keystroke.
  2. Pick the MIME type that matches the payload. text/plain is the default; use text/html for snippets you'll render in an iframe, image/svg+xml for inline icons, application/json for API mocks, and Custom for niche types like application/vnd.api+json.
  3. Choose the encoding. URL-encoded (default) uses percent escapes and keeps short payloads human-readable; Base64 is binary-safe and usually shorter for large or byte-heavy inputs, at the cost of being opaque to humans.
  4. Toggle the charset. Keeping ;charset=utf-8 is the safe default for text-based MIME types; omit it only when you specifically need the default (US-ASCII for text/*) or when using a MIME where charset is meaningless.
  5. Read the stats line: MIME, encoding, input characters, UTF-8 bytes, URI length, and size-ratio percentage. URL-encoded payloads with many special characters push the ratio well past 100 %; Base64 settles around 133 %.
  6. Copy or Download, or press Ctrl+Enter (⌘+Enter on Mac) to generate and copy in one shortcut. Reset options returns all four controls to their defaults without losing the input payload.
  7. Use the URI. Drop it into <img src>, background-image: url(…), <iframe src>, a Markdown image link, or as the body of a fetch request - anywhere a URL is accepted, a data URI works.

Frequently asked questions

What is a data URI?

A URL scheme that embeds the resource inline – data:<mime>[;charset=…][;base64],<payload>. Defined in RFC 2397, they let you skip an HTTP request by putting a file’s bytes directly into the URL.

Why use data URIs?

To inline small assets in HTML/CSS (saving a network round-trip), to mock API responses in tests, to attach a preview to a link, or to ship a self-contained page where every resource is embedded in the markup.

URL-encoded vs Base64 – which should I use?

URL-encoded is shorter and human-readable for ASCII-heavy text (plain text, JSON, short HTML). Base64 is binary-safe, always a predictable 4/3 ratio, and the only sensible choice for SVG, large text, or anything with many special characters.

Is my data secure?

Yes. Encoding runs entirely in your browser – nothing is uploaded, cached, or tracked. After the page loads you can disconnect the network and keep encoding indefinitely.

What is the correct MIME for an SVG data URI?

image/svg+xml. Pair it with the Base64 encoding and you get a URI that works in every browser’s background-image: url(data:…) or <img src>.

Does it work offline?

Yes. HTML, CSS, and JavaScript are self-contained. Once the page has loaded, you can turn off Wi-Fi and the tool keeps working.

Is it free?

Yes, 100% free with no cap on input length or number of encodes. No sign-up, no premium tier, no watermark.

Are there size limits?

The tool has no cap, but browsers do. Chrome and Firefox handle URIs into the megabytes; older mobile browsers can choke around 32 KB. For large payloads prefer a real file URL or object URL.

Why does the ;charset=utf-8 matter?

RFC 2046 says text/* MIME types default to US-ASCII when no charset is present, which breaks anything non-ASCII. Keep the toggle on for text-based MIMEs unless you really know you want the old default.

How do I decode a data URI back to text?

Use the sibling Data URI to ASCII converter. It handles both the URL-encoded and Base64 variants with or without the charset fragment.