Image to Base64
Turn an image into a data URI you can paste straight into CSS or HTML.
Runs in your browser — your files are never uploaded
Drop an image here
or
Up to 5 MB. Larger images produce enormous strings that slow a page down rather than speeding it up.
About the Image to Base64
A Base64 data URI puts the image itself inside the markup, so the browser needs no separate request to fetch it. For a small icon that is a genuine win — one fewer round trip, and the image appears at the same moment as the page that uses it.
For anything larger it is usually a mistake, and this tool shows you why rather than leaving you to find out. Base64 makes the data about a third larger, and an inlined image cannot be cached separately: every time the page or stylesheet changes, the entire image is downloaded again. A 200 KB photograph inlined into a stylesheet makes that stylesheet 270 KB and blocks rendering until it arrives.
The rough rule is a few kilobytes. Below that, inlining saves more than it costs. Above it, a normal image file loads faster and caches properly.
Four output shapes are offered: the raw Base64, a complete data URI, a CSS background rule and an HTML image tag — so you can paste the one you actually need rather than assembling it yourself.
The encoding happens in your browser and nothing is uploaded.
How to use the Image to Base64
Add an image
Up to 5 MB, though anything above a few kilobytes is usually better left as a normal file.
Check the overhead
The encoded size and the percentage increase are shown, so you can judge whether inlining is worth it.
Pick the output you need
Raw Base64, a data URI, a CSS background rule, or a complete HTML image tag.
Copy it
One click puts it on your clipboard, ready to paste into your stylesheet or markup.
Frequently asked questions
When should I inline an image as Base64?
Why does the Base64 make my file bigger?
Does an inlined image get cached?
Does this work in email?
Is my image uploaded?
You may also need
Base64 Encoder
Encode text to Base64, including emoji and every alphabet, with a URL-safe option.
Image Compressor
Make JPG, PNG and WebP files smaller without a visible drop in quality.
JPG to WebP
Convert JPG and PNG images to WebP and make them meaningfully smaller for the web.
Image Metadata Remover
See exactly what your photo reveals — including where it was taken — then strip it.