We use essential cookies to make this site work. Optional analytics cookies help us improve your experience. Privacy Policy
Data URI Generator
Convert text or files to Base64 data URIs instantly in your browser. 100% free, private, and browser-based — no sign-up. Free, private, and runs locally.
); }; const handleFile = (e: React.ChangeEvent) => { const file = e.target.files?.[0]; if (!file) return; const reader = new FileReader(); reader.onload = () => { setDataUri(reader.result as string); setMimeType(file.type || "application/octet-stream"); }; reader.readAsDataURL(file); }; const copy = () => { navigator.clipboard.writeText(dataUri).then(() => toast.success("Copied to clipboard")); }; return ( Data URI Generator
Encode text or any file into a Base64 data URI for embedding in CSS, HTML, or JSON.
setMode("text")}>Text setMode("file")}>File {mode === "text" ? ( <> Text setText(e.target.value)} rows={4} /> MIME Type setMimeType(e.target.value)} placeholder="text/plain" /> Convert to Data URI > ) : ( <> fileRef.current?.click()}>
Click to upload a file
> )} {dataUri && ( <> Result Copy > )}
Who Is This For?
Developers embedding images in CSS/HTML
Email template builders
API testers needing inline payloads
Common Uses
Inline images without external requests
SVG data URIs for backgrounds
Base64 encode small files for transport
Frequently Asked Questions
What is a Data URI?
A URI scheme that includes data inline, allowing files to be embedded directly in documents.
Is this processed locally?
Yes. File encoding uses the browser FileReader API; nothing is uploaded.
Is there a size limit?
Very large files may cause browser slowdown. This tool works best for files under a few MB.
About Data URI Generator
A data URI lets you embed a file directly into your HTML or CSS instead of linking to an external URL. Useful for tiny icons, single-file demos, or email signatures where you cannot rely on remote assets loading. This generator converts any file to a base64 data URI in your browser.
When to Use Data URIs
very small assets (under ~2 KB): icons, small backgrounds, single-pixel transparent PNGs, custom cursors. Also useful for standalone HTML that must render offline (email signatures, exported reports). For anything over a few KB, the base64 encoding inflates the file by ~33% and costs you HTTP caching — a regular
Related free tools
XML Formatter & Minifier — Beautify or minify any XML — SOAP, RSS, SVG, sitemap. Browser-based parser.
XML to JSON Converter — Parse any well-formed XML into a clean JSON tree with attributes and arrays.
JSON to XML Converter — Convert JSON to well-formed XML — supports attributes, custom root, declaration.
CSV Viewer — Open CSV or TSV files in your browser — sort, search, paginate, export filtered view.
JSON to CSV Converter — Convert JSON data to CSV format. Export to spreadsheets easily.
CSV to JSON Converter — Convert CSV data to JSON format. Useful for API development.
JSON Formatter — Format, beautify, or minify JSON with customizable indentation.
JSON Validator — Validate JSON syntax and find errors with line and column numbers.
HTML Minifier — Compress HTML by removing comments, whitespace, and line breaks.
CSS Minifier — Minify CSS by stripping comments, whitespace, and unnecessary characters.
JavaScript Minifier — Compress JavaScript by removing comments, whitespace, and empty lines.
Base64 Encoder/Decoder — Encode text to Base64 or decode Base64 back to text. UTF-8 support.