Data URI Generator & Parser
Generate Data URIs from text or files, and parse existing Data URIs to extract their content and metadata.
Last Updated: October 2026
100% Client-Side — Your data never leaves your device
Generation Options
Data URIs in Code
How to programmatically generate and parse Data URIs.
JavaScript
// Generate a Data URI from text
const text = "Hello World";
const base64 = btoa(text);
const dataUri = `data:text/plain;base64,${base64}`;
console.log(dataUri); // data:text/plain;base64,SGVsbG8gV29ybGQ=
// Parse a Data URI
const uri = "data:text/plain;base64,SGVsbG8gV29ybGQ=";
const match = uri.match(/^data:([^;,]*)(;base64)?,(.*)$/);
if (match) {
const mime = match[1];
const isBase64 = !!match[2];
const data = match[3];
const decoded = isBase64 ? atob(data) : decodeURIComponent(data);
console.log({ mime, decoded }); // { mime: "text/plain", decoded: "Hello World" }
}Frequently Asked Questions
Search below or browse through our most commonly asked questions.
A Data URI is a scheme that allows you to include data in-line in web pages as if they were external resources. It's often used to embed images in CSS or HTML.
No, Data URIs can also contain plain text or URL-encoded data. However, Base64 is the standard for embedding binary files like images.
Related Tools
Base64 Converter
Encode text to Base64 or decode Base64 to text — all in one tool
Image to Base64
Convert PNG, JPG, GIF, SVG, and WebP images to Base64 data URIs
CSS Data URI Converter
Convert images to Base64 data URIs for CSS background-image properties
MIME Type Inspector
Analyze Base64 strings to instantly detect their underlying MIME type using magic numbers