Convert an image to Base64
Turn a small image into a data URI you can paste straight into HTML, CSS or JSON, with no separate file and no extra request. Best for tiny icons. Runs in your browser, so nothing is uploaded.
Drop image here or click to upload
Supports JPG, PNG, WEBP, GIF - Max 20 MB
Base64 Data URI Output:
Usage examples:
HTML: <img src="[paste output here]" alt="...">
CSS: background-image: url("[paste output here]");
JSON: "image": "[paste output here]"
An image you can paste into code
The output is one long string starting with data:image. Drop it anywhere a URL goes and the image is right there, no file to host.
<!-- HTML --> <img src="data:image/png;base64,iVBORw0KGgoAAAANSU..."> /* CSS */ .logo { background: url("data:image/png;base64,iVBORw0KGgoAAAANSU..."); }
The string is about a third bigger than the original file, which is fine for a small icon and a bad idea for a big photo.
When Base64 helps, and when it hurts
Tiny assets
A small icon, a 1px gradient, an inline SVG fallback. Inlining them saves an HTTP request with little size cost.
Real photos
A full photo as Base64 bloats your file, blocks caching, and usually loads slower than a normal image link.
Frequently asked questions
Base64 represents binary data with text, which costs about 33 percent more size. A 100 KB image becomes roughly 133 KB of string. That is inherent to the encoding, not something the tool can avoid.
Paste the whole string, including the data:image prefix, into an img src: img src="data:image/png;base64,iVBOR...". That is the entire image, no separate file needed.
No. Base64 suits tiny assets, an icon or a 1px gradient under a few KB. A big image as Base64 bloats your HTML or CSS and stops the browser caching the image on its own, which is usually slower overall.
A way to put a small file directly inside HTML or CSS as text. The shape is data:[type];base64,[the encoded bytes], so the browser knows it is, say, a PNG and decodes it inline.
No. The file is read with the browser FileReader and encoded locally. Nothing is sent to a server.