Removes a network request
Inlining a small icon as a data URI means one less HTTP round trip — a genuine win for critical above-the-fold assets like logos and bullet icons.
Encode an image as a Base64 string or a ready-to-paste data URI.
Loading tool…
The tool is loading its code on your device. This happens once and is cached for later visits.
Processed entirely on your device
Overview
Convert JPG, PNG, WebP, GIF or SVG files into Base64 text and data URIs for CSS, HTML and JSON. Get the exact character count and size overhead first.
Base64 is how binary data travels through text-only channels. JSON payloads, HTML attributes, CSS values and email bodies all expect characters, not bytes — so an image has to be translated into a safe alphabet of 64 printable characters (A–Z, a–z, 0–9, plus and slash) before it can ride along.
Raw Base64 is just the encoded characters. Use it when an API expects an image field, or when you are constructing the prefix yourself.
Data URI prepends the MIME declaration: data:image/png;base64,iVBORw0…. This is what goes into <img src> and <source srcset>.
CSS wrapper adds the url("…") quoting so it drops straight into background-image. Quotes matter — an unquoted data URI containing + or / can break some CSS parsers.
Inlining is not automatically faster. It removes a request, but it also:
The rule that holds up in practice: inline tiny, always-needed graphics (under roughly 2–4 KB), and let everything else be a normal cached file. A 200 KB hero image inlined as Base64 will make your page measurably slower, not faster.
The prefix must match the actual encoded format. A PNG declared as image/jpeg may still render in forgiving browsers, but it will fail in strict ones and in some image-processing libraries. This tool derives the MIME type from the file's real content rather than trusting its extension, which matters when a .png file is actually a renamed JPEG.
Step by step
Upload an image file — PNG, JPG, WebP, GIF or SVG.
Choose the output shape: raw Base64, a full data URI, or CSS-ready background syntax.
Press Encode; the string is generated locally from the file's bytes.
Copy the result with one click, or download it as a .txt file.
Check the reported overhead before inlining anything large.
Why use it
What this tool is good for, and what it deliberately does not try to do.
Inlining a small icon as a data URI means one less HTTP round trip — a genuine win for critical above-the-fold assets like logos and bullet icons.
Bare Base64 for APIs, a complete data URI with the correct MIME prefix for HTML src attributes, and a url(...) wrapper ready to paste into a stylesheet.
Base64 inflates binary data by about 33%. The tool reports both the original byte size and the encoded length so you can decide whether inlining is worth it.
For SVG you often want the raw markup rather than an encoding; the tool notes this and lets you compare both options.
Questions
Short, honest answers about quality, limits and privacy.