The Data URI to File Converter takes a data: URI and turns it back into a real,
downloadable file. Paste the string, confirm the MIME type and size, preview
images inline, and save the decoded bytes — all in your browser.
How it works
A data URI follows the form defined by RFC 2397:
data:[<mime-type>][;base64],<payload>
The converter splits the string at the first comma into a header and a payload, then:
- reads the MIME type from the header (defaulting to
text/plainwhen absent); - checks for the
;base64flag; - decodes the payload — base64 via the browser’s
atob, or percent-decoding for text data URIs — into a byte array; - chooses a file extension from the MIME type using a built-in map.
The decoded bytes are wrapped in a Blob and offered as a download through a
temporary object URL, which is revoked immediately after the click.
Worked example
The URI data:text/plain;base64,SGVsbG8h decodes to the bytes for Hello! and
downloads as a .txt file. A data:image/png;base64,... string previews the
image inline, then downloads as a .png.
| Header example | Encoding | Extension |
|---|---|---|
data:image/png;base64, | base64 | .png |
data:application/pdf;base64, | base64 | |
data:text/html, | percent-encoded | .html |
data:application/octet-stream;base64, | base64 | .bin |
When you need this tool
CSS and HTML inline assets: Design tools and code generators frequently embed icon SVGs, small background images, or fonts directly inside stylesheet strings as data URIs. If a designer hands you a CSS file and you need to extract a specific asset, paste the data URI here and download it.
API responses and JSON payloads: Some APIs return file contents base64-encoded inside a JSON field rather than as a separate download URL. Copy the value of that field, prepend the correct data:<mime>;base64, header, and the tool recovers the file.
Debugging content-security-policy issues: When a browser refuses to load an inlined data URI resource and you need to inspect what the payload actually contains, decoding it here lets you see the raw file without relaxing the CSP.
Email attachments and clipboard blobs: Some automation pipelines pass file data as URI strings through clipboard or notification payloads. This tool is the quickest way to turn those strings back into usable files.
Common mistakes
- Missing the
data:prefix. The full URI string must start withdata:, not just the base64 payload. - Truncated strings. Base64 data URIs can be long — tens of thousands of characters for even a small image. Make sure you copy the entire string; a truncated URI decodes to a corrupt or empty file.
- Wrong MIME type. If the tool picks the wrong extension, you can set a custom filename with the correct one before downloading.
This is the inverse of a base64 file encoder. Because decoding and the download both happen locally, no part of the embedded file — which may contain private images or documents — is ever transmitted.