Data URI generator
Embed any file as a base64 data: URI, on your device.
Runs on your device. The file is never uploaded.
Data URI generator encodes a file as one data: URI line, with the MIME type read from its magic bytes. Text formats carry no signature, so txt, csv, html, json, svg and yaml fall back to the extension; anything unknown becomes application/octet-stream. Encoding is always base64, and no file is written since the URI itself is the result.
Questions
How does it choose the MIME type?
First from the magic bytes of the file, using the same signature table the Detect file type tool uses. Formats with no magic bytes, mostly text ones, fall back to a small table keyed on the extension covering txt, csv, tsv, html, css, js, json, xml, svg, md, yaml and a few more. Anything still unknown becomes application/octet-stream.
Why is the data URI bigger than my file?
Because base64 encodes three bytes as four characters, so the payload is about a third larger before the data: and MIME prefix is added. That is inherent to the encoding, not something the tool can tune. It is why data URIs suit small icons and fonts rather than photographs.
Why did I only get text instead of a file?
That is the output. The tool produces a single line of text, the complete data: URI, for you to copy into your CSS, HTML or source code. No file is written, because the URI itself is the result. Select the line and copy it into your source; the whole URI is on one line, so it pastes cleanly.
Can I do several files at once?
Yes. It works per file, so each file you drop produces its own data URI, each detected and encoded separately. They are listed one after another so you can copy the one you want. Each URI carries its own detected MIME type, so a folder mixing images and text files works in a single run.
Are there any options?
None. Encoding is always base64, never the percent encoded form some data URIs use, and the MIME type is always detected rather than typed in. If the detected type is wrong for your purpose, edit the type in the string after you copy it.
Does my file get uploaded?
No. It is read into memory and encoded in your browser. Nothing is sent to a server, which matters here because a data URI is often made from something you are about to embed in a private page. The file and the encoded string are both in memory, so a large file is limited by your device.