Data URI Generator – Free Online Tool
Turn any file into a data URI for HTML/CSS. Upload or paste text — free, private, no signup.
Tool Interface
Turn any file into a data URI you can embed directly in HTML and CSS. Upload a file or paste text — the encoding happens entirely in your browser.
Drop a file here or click to browse
Images, fonts, audio, SVG, anything
How it works
- Upload a file or paste text, then click Generate.
- Leave MIME as "auto" to detect it from the file, or type one yourself.
- Copy the data URI into an img src, CSS url() or font-face.
- Base64 output is about 33% larger than the original file.
- URL-encoded output is usually smaller for SVG and text — paste it straight into CSS.
100% private — your files never leave your browser.
Rate this tool
About This Tool
Data URI Generator – Turn Files Into Embeddable Data URIs
Need to embed an image, font, or SVG directly in your HTML or CSS — with no extra HTTP requests? A data URI (data:[mime];base64,...) packs the file right into your code. Trencada's Data URI Generator creates them instantly: drop any file (or paste text, SVG, or CSS), choose Base64 or URL encoding, and click Generate. You get a ready-to-paste data URI with size stats, an image preview, one-click copy, and a .txt download. No signup needed — and your files never leave your browser, because everything is read and encoded locally with zero uploads.
How to Use the Data URI Generator
- Provide your source. Drag & drop a file (or click to browse), or paste text, SVG markup, or CSS into the text box. Click "Sample SVG" to try a demo.
- Set the MIME type. Leave it as "auto" to detect the MIME type from your file, or type one manually (e.g.,
image/svg+xml). - Choose the encoding. Pick Base64 (recommended) for binary files like images, fonts, and audio — or URL-encoded for SVG and text (usually smaller, pastes straight into CSS).
- Click "Generate". Your data URI appears with stats (MIME, original size, data URI size, overhead %) and an image preview where applicable.
- Copy or download. Click "Copy data URI" to paste it into an
img src, CSSurl(), or@font-face— or "Download .txt" to save it asdata-uri.txt.
Key Features
- File or text input — drop any file, browse, or paste SVG, CSS, or plain text directly.
- Automatic MIME detection — detects the MIME type from your file, or set it manually.
- Two encodings — Base64 (recommended) and URL-encoded (best for SVG/text).
- Live size stats — MIME, original size, data URI size, and overhead percentage.
- Image preview — instant visual preview for image files.
- Copy & download — one-click copy, or download the URI as
data-uri.txt. - 100% private — files are read and encoded locally in your browser; nothing is ever uploaded.
Why Choose Trencada?
- Free and unlimited — generate as many data URIs as you need, no signup.
- Private by design — the FileReader API and local encoding mean your files never leave your device; Trencada never sees or stores them.
- Built for developers — need the right MIME type first? Find it with our MIME Type Lookup, or encode text directly with the Base64 Encoder.
- Fast and accurate — instant local encoding with clear size stats.
Frequently Asked Questions
What is a data URI?
A data URI (e.g., data:image/png;base64,iVBORw0...) embeds a file's contents directly in a URL-like string, so you can include images, fonts, or SVGs in HTML and CSS without separate files or extra HTTP requests.
Is the Data URI Generator free?
Yes — it's completely free with unlimited generations and no signup required.
Are my files uploaded to a server?
No. Your files are read and encoded 100% locally in your browser using the FileReader API. Nothing is uploaded, sent anywhere, or stored by Trencada.
Should I use Base64 or URL encoding?
Use Base64 (recommended) for binary files like images, fonts, and audio. Use URL-encoded for SVG and text — it's usually smaller and pastes straight into CSS. Note that Base64 output is about 33% larger than the original file.
How do I use the data URI in my code?
Click "Copy data URI", then paste it into an image src, a CSS url(), or an @font-face declaration.