AAllMyToolsa pocketful of little tools
B64

Image to Base64 converter

ImagesNo. 35 / 84

Turn a JPEG or PNG into a base64 data URL, with a copy-ready HTML snippet. The file never leaves your browser.

a picture disguised as text, which is exactly what a data URL is.

work surface

Math, not advice — results are indicative.Read the disclaimer.

most-used utilities

An inline icon

Convert a small PNG and paste the data URL into an img tag.

A CSS background

Copy the data URL and use it inside url() in a stylesheet.

An email-safe image

Use a small JPEG data URL when the email client blocks remote images.

pro tips

Use base64 for icons and tiny assets, not for hero images or photo galleries.

The data URL includes the MIME type; if you paste only the base64 string, you have to supply the type yourself.

Base64 is about 33% larger than the original file, before any compression.

what it does

A data URL is a file encoded as text and prefixed with its MIME type. This page reads a JPEG or PNG locally and gives you the full data URL, the raw base64 string and an HTML img tag you can paste into a document.

It is handy for small icons, inline SVG alternatives, email templates and situations where a separate image request is inconvenient. It is a bad idea for large photographs: base64 makes the payload roughly a third bigger, and a multi-megabyte photo becomes a multi-million-character string.

A 2 KB icon becomes a few thousand characters, which is manageable. A 2 MB photo becomes several million, which will make an HTML file unpleasant to open and a chat message impossible to send.

Choose a file, copy whichever form you need, and close the tab. The data is read with the browser's FileReader and never sent anywhere.

quick answers

Is base64 bigger than the original file?

Yes, roughly a third bigger. The encoding represents every byte with more characters than the binary original.

Can I use the data URL in CSS?

Yes. Wrap it in url() as a background or mask value: url(data:image/png;base64,...).

Is the image uploaded?

No. The file is read locally with the browser's FileReader and never leaves your device.