Image to Base64 Encoder
Turn an image into a data URI, with CSS and HTML snippets.
Drop an image here, or
Nothing is uploaded — the file stays in your browser.
Runs entirely in your browser. Nothing you paste is uploaded, logged, or stored.
How to use it
- Choose an image file.
- Pick the output shape: data URI, CSS, HTML, or raw Base64.
- Copy the snippet straight into your code.
What it does
Reads your image and produces a Base64 data URI, along with ready-made CSS and HTML snippets. The tool also reports how much larger the encoded version is, which is the number that decides whether inlining is a good idea.
When inlining actually helps
Base64 inflates a payload by roughly 33%, so it only pays off when avoiding an HTTP request costs more than the extra bytes. That's true for tiny assets — a 1×1 tracking pixel, a small SVG icon, an email-safe logo. It's false for photographs, where you add a third of the weight, block rendering, and lose the ability to cache the image separately.
FAQ
- Are my images uploaded to a server?
- No. Every tool here decodes and re-encodes your file using your browser's own Canvas APIs. The image never leaves your device, which is also why it works offline once the page is loaded.
- Why is the Base64 version bigger than my file?
- Base64 encodes three bytes into four ASCII characters, so the output is about 33% larger by design. That's inherent to the encoding, not a flaw in the tool.
- Should I inline images as Base64 for performance?
- Only very small ones. Inlined images can't be cached independently, they bloat the HTML or CSS that blocks rendering, and they cost a third more bytes. Under a couple of kilobytes it can be a win; beyond that it's usually a loss.