Image to Base64 Converter
Convert an image to Base64 and a data URL, with ready-made CSS and HTML snippets and the size overhead reported honestly.
.png that is really a JPEG is encoded with the correct MIME type regardless of what it is called, so the snippets you copy will actually work.How it works
- Choose an image, or drop one onto the box.
- The file is read in your browser and encoded to Base64 — nothing is uploaded.
- Copy the raw Base64, a data URL, or a ready-made CSS or HTML snippet.
Frequently Asked Questions
What do I get back?
The raw Base64, a complete data URL, a CSS background-image declaration and an HTML img tag — the three forms people actually paste. The alt text you supply is HTML-escaped, because that string ends up inside an attribute in your own page.
Why is the Base64 bigger than my file?
Base64 encodes three bytes as four characters, so the result is about 33% larger plus padding. The exact overhead is shown. That is the trade-off for inlining: one fewer request, more bytes. For anything above a few kilobytes a normal file reference is usually faster.
How is the format determined?
From the file’s magic bytes, never its extension or its reported MIME type — both are trivially wrong. PNG, JPEG, WebP, GIF, BMP, AVIF, ICO and SVG are all recognised.
Is my image uploaded?
No. Encoding happens in your browser and the file never leaves it. The filename is not sent to analytics either.