Home Tools Blog About

Convert Text to Data URI

In short

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

  • Runs in your browser
  • Nothing uploaded
  • Free, no sign-up

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.

🛡
100% PrivateNo server uploads, ever
InstantRuns in your browser
💧
No WatermarksClean output, always
🆓
Free ForeverNo accounts, no limits

How to Use Convert Text to Data URI

  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.

Keep going

Related Tools

All Ascii tools →

Convert Data URI to ASCII

online Data URI decoder. RFC 2397 compliant, handles Base64 and URL-encoded payloads. Client-side, instant,…

Convert Data URI to Image

online Data URI to image decoder. Magic-byte format detection, dimension extraction, correct file download.…

Convert Data URI to UTF-8

online Data URI to UTF-8 decoder with byte-breakdown panel for emoji and CJK. Client-side,…

Convert Image to Data URI

Convert images to base64 data URIs preserving original format. HTML/CSS/Markdown wrappers. Free, offline, client-side.

Convert UTF-8 to Data URI

Convert UTF-8 text to data: URI (percent or base64), 9 MIME types + custom,…

Add Text to Image Online - Text on Photo

Add text to images online for free. Overlay text on your photos. Fast, private,…

Add Text to WEBP

Add text, captions, or watermarks to your WEBP images directly from your browser. Our…

AES-256 Text Encryptor

Encrypt and decrypt text with AES-256-GCM encryption. Works 100% offline in your browser using…

Convert Binary to Text

Convert text to binary and binary to text instantly. Free, offline, client-side UTF-8 encoder…

Center Unicode Text

Center Unicode text within a fixed width, with real grapheme counting for emoji and…

Check Spoofed Unicode Text

Detect Unicode confusables and homoglyphs from Cyrillic, Greek, Armenian, and Hebrew that imitate Latin…

Chunk List Text

Split any list into fixed-size chunks with line/numbered/labeled/custom-separator output. Live preview, keep-or-drop trailing chunk.…

Share

Embed this tool

Add this free tool to your website. Copy and paste the code: