Data URI Converter
Convert a file into a base64 Data URI (data:...;base64,...) ready to embed in HTML or CSS, or decode an existing Data URI into a downloadable file.
File to Data URI
Data URI to file
How it works
Want to embed a small image directly in a CSS or HTML file without an extra network request, or send a binary file inside a JSON text field? A Data URI encodes a file's contents in base64 within a self-contained string, usable directly as the value of a src or background-image attribute. The tool converts both ways: file to Data URI, and Data URI to downloadable file.
Why is my Data URI much larger than the original file?
Base64 encoding increases size by about 33%, because each group of 3 binary bytes is represented by 4 text characters. That's the trade-off required to carry binary data in a pure text format (HTML, CSS, JSON).
What MIME type should I specify for encoding?
The MIME type corresponding to the file (for example image/png, image/jpeg, application/pdf): it's usually pre-filled automatically from the selected file, but you can correct it if needed.
100% local processing: encoding and decoding run entirely in your browser via WebAssembly — your file never leaves your device.