Data URI Generator
Paste text, SVG or HTML and get a data: URI you can drop straight into CSS or HTML. Choose base64 for arbitrary content, or compact URL encoding that keeps SVG small and readable. Everything runs in your browser.
How to make a data URI
- Paste your content and set the MIME type (for example image/svg+xml).
- Choose URL encoding for SVG or base64 for other content.
- Copy the data URI, or the ready-made CSS background or HTML img snippet.
Examples
Plain text as a data URI
Hello
data:text/plain;base64,SGVsbG8=
SVG with compact URL encoding
<svg xmlns="http://www.w3.org/2000/svg" width="2" height="2"></svg>
data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='2' height='2'%3E%3C/svg%3E
Frequently asked questions
What is a data URI?
A data URI embeds a file directly inside a URL using the data: scheme, so the content travels inline instead of being fetched separately. It looks like data:<mime>;base64,<data> or data:<mime>,<url-encoded>, and works anywhere a URL does, such as a CSS background-image or an HTML img src.
When should I use a data URI?
They are best for small, static assets like icons, SVG shapes, fonts or tiny images. Inlining them removes an extra HTTP request, which helps above-the-fold rendering and self-contained emails or single-file pages. For large or frequently changing files a normal URL is better, because data URIs are not cached on their own and the base64 form adds about a third to the byte size.
Should I use base64 or URL encoding?
Use URL encoding for SVG and other text-based markup. It is usually smaller than base64 and stays human-readable, so you can still read the markup inside the URI. Use base64 for binary or arbitrary content where readability does not matter.
How is the SVG URL encoding done?
Rather than escaping everything with encodeURIComponent, which roughly doubles the size, this tool escapes only the characters that would break the URI: % # < and >. Double quotes are swapped for single quotes (valid in SVG) so the result can sit inside a double-quoted CSS url() or HTML attribute, and runs of whitespace are collapsed. The SVG renders identically but stays compact and readable.
Does it handle emoji and accented text?
Yes. Base64 output is UTF-8 safe, so emoji, accents and other multi-byte characters are encoded correctly and decode back to the exact original.
Is my content private?
Yes. The data URI is generated entirely in your browser, so nothing you paste is uploaded or stored on a server.
Related tools
Base64 Encode
Encode text to Base64 online. UTF-8 safe, handles emoji and accents, with an optional URL-safe (base64url) mode. Runs in your browser, nothing uploaded.
URL Encoder
URL encode text online with percent-encoding. Escape spaces and reserved characters for a query value, or encode a full URL. Free and private.
SVG Blob Generator
Generate organic SVG blob shapes with a live preview. Set points and randomness, pick a color or gradient, then copy or download the SVG.
.env to JSON
Convert a .env file to JSON, or JSON back to .env. Parses KEY=value lines, comments, quotes and export. Runs entirely in your browser.
Aspect Ratio Calculator
Calculate aspect ratios fast. Enter a ratio like 16:9 and one dimension to get the other, or enter width and height to simplify the ratio.
Base58 Encoder
Encode and decode Base58 online with the Bitcoin alphabet. Convert text to Base58 or back, UTF-8 safe, no confusing 0 O I l. Runs in your browser.