Image to Base64
Convert an image into a Base64 data URL for embedding in HTML/CSS.
Drag & drop an image, or click to browse
Convert an image to Base64
Upload a PNG, JPG, WebP or SVG and get a Base64 string you can paste straight into HTML or CSS. The conversion runs in your browser, so the file isn't sent anywhere. Paste a Base64 string in the other field and it decodes back to a downloadable image.
Base64 encoding turns binary data into plain text using 64 safe characters. That lets an image travel inside a text-only context — a stylesheet, a JSON payload, an email body — without needing a separate file request.
Using the output
The result is a data URI: a prefix declaring the MIME type, then the encoded data. In HTML it goes straight into an img tag's src attribute. In CSS it slots into a url() value. Both work in every current browser.
Copy the whole string including the data:image/png;base64, prefix — dropping it is the single most common reason a pasted data URI silently fails to render.
When it's worth doing
- Small icons and logos — inlining removes an HTTP request, which can help on a page with many tiny assets.
- Self-contained files — an HTML email or a single-file report that must render without external dependencies.
- APIs and JSON — sending an image through a text-only field.
- Avoiding hotlink issues — the image travels with the document rather than being fetched from a server.
The trade-off
Base64 makes data about 33 percent larger. Three bytes become four characters, so a 60 KB image becomes an 80 KB string. That cost is invisible for a 2 KB icon and painful for a 500 KB photograph.
Inlined images also can't be cached separately. A normal image file is downloaded once and reused across every page; a Base64 string is re-downloaded with every page that contains it, and bloats the HTML or CSS it sits in. Large data URIs in a stylesheet delay rendering, because the browser has to parse the whole file before it can paint.
Rule of thumb: inline images under a few kilobytes. Anything larger is almost always better as a normal file. If you're inlining to save requests, compress the source first with our image compressor.
Frequently Asked Questions
How do I convert an image to Base64?
Upload it above and copy the generated string. Include the data URI prefix when pasting into HTML or CSS.
Can I convert Base64 back to an image?
Yes. Paste the string into the decode field and download the result as a PNG or JPG.
Does Base64 make files bigger?
Yes, by roughly a third. Encoding is about making binary data text-safe, not about compression.
Is Base64 encryption?
No. It's an encoding anyone can reverse in seconds. It offers no security whatsoever — never use it to hide sensitive data.
Is my image uploaded to a server?
No. Encoding and decoding both happen locally in your browser.
Which formats can I encode?
PNG, JPG, GIF, WebP and SVG all work. The MIME type in the prefix changes to match the source format.