A data URI lets you embed a resource directly inside HTML, CSS, or JSON instead of linking to a separate file — perfect for tiny icons, inline SVG, or short snippets. This tool builds and decodes data URIs in your browser.
How it works
A data URI has the form data:[mediatype][;base64],data:
- The text is converted to UTF-8 bytes.
- Base64 mode encodes those bytes with the standard alphabet and emits
data:<mime>;base64,<base64>. - Percent-encoding mode leaves unreserved ASCII bytes (
A-Z a-z 0-9 - . _ ~) as-is and writes every other byte as%XX, emittingdata:<mime>,<percent-encoded>.
Decoding parses the prefix to read the MIME type and detect the ;base64 flag, then reverses the matching transform to recover the original text.
Tips and examples
The text Hi with MIME text/plain and Base64 gives data:text/plain;base64,SGk=. The same text percent-encoded gives data:text/plain,Hi. For inline SVG, image/svg+xml with percent-encoding usually beats Base64 because SVG is mostly ASCII. Remember that Base64 adds roughly 33% size, so reserve data URIs for small assets where saving an HTTP request matters more than bytes on the wire.