Data URI Generator
Convert text or files (images, fonts, PDFs) into base64 data URIs for inline embedding in HTML/CSS, or decode data URIs back to text. RFC 2397 compliant, custom MIME types, drag-drop. 100% client-side, no uploads.
Loading tool...
What is Data URI Generator?
The Data URI Generator converts text or uploaded files into RFC 2397 data URIs β self-contained "data:" URLs that embed the file inline as base64 or URL-encoded text. It also works in reverse, decoding any data URI back into its original text and showing the detected MIME type.
Key Benefits
- Eliminate extra HTTP requests by inlining small images, fonts, and SVGs directly in HTML or CSS.
- Bundle assets into a single self-contained HTML or CSS file for emails, widgets, or offline docs.
- Reduce render-blocking and speed up first paint for icons and UI assets.
- Inspect the real MIME type and payload of any data URI you encounter.
- Everything runs 100% client-side β no file ever leaves your device.
Common Use Cases
- β’Inlining small icons or logos into CSS backgrounds to cut HTTP requests.
- β’Embedding fonts or SVG assets inside a single HTML email or widget.
- β’Building self-contained offline HTML documentation or reports.
- β’Verifying and debugging data URIs found in third-party CSS or HTML.
How to Use the Data URI Generator
- Choose a mode: Click Encode to turn text/files into a data URI, or Decode to convert a data URI back.
- Provide input: Type or paste text (encode), or paste a data: URI (decode). For files, pick the Base64 encoding and use the file picker.
- Optional MIME: Set a custom MIME type if needed, otherwise the tool auto-detects it from the filename or defaults to text/plain.
- Copy or swap: Copy the result to your clipboard, download the original file, or use Swap to feed the output back as new input.
Key Features
- Encode text or uploaded files (images, PDFs, fonts) into base64 data URIs.
- Decode any data URI back to text with automatic MIME and base64/URL detection.
- Optional custom MIME type for non-standard or application-specific payloads.
- Filename-based MIME sniffing for common image, audio, video, font, and document formats.
- UTF-8 safe base64 handling for multi-byte text with chunked encoding.
- One-click copy, swap, and download β 100% client-side, no uploads.