Free Online Image to Base64 Converter
Turn an image into a Base64 data URI that you can paste into an HTML image tag, a CSS background or a JSON file. You can also paste a data URI and download it as an image. Your file stays in your browser.
How to Use Image to Base64 Converter?
Choose Mode
Select "Image to Base64" to encode or "Base64 to Image" to reverse decode.
Upload or Paste
Drop your PNG, JPG, SVG, or WebP file, or paste your raw Data URI string.
Copy Snippets or Download
Copy Data URI, HTML <img> tag, CSS background code, or export the decoded image.
When to use Base64 data URIs for images
A Base64 data URI puts an image straight into your HTML, CSS or JSON as text. The encoded text is about 33% larger than the file, so it is best for small images. A large photo is better served as a normal image file, because the browser can cache it and the page stays light.
Where it helps
- Small icons and spinners: a tiny image embedded in the page needs no extra request, so it shows up with the page.
- Single-file HTML: email templates and offline documents can carry their own images without extra files.
- Small CSS patterns: a small repeating background or icon can be placed directly in the stylesheet.
Decoding a data URI
Switch to the Base64 to Image tab and paste a full data URI that starts with data:image/. If you paste only the Base64 characters, the tool assumes the image is a PNG, so paste the full URI when the image is a JPG, SVG or WebP.
Frequently Asked Questions
What is an Image Data URI and how does Base64 encoding work?
A Data URI puts the image data directly into your HTML or CSS as a Base64 text string (for example data:image/png;base64,...), so the browser does not need to download the image as a separate file.
Why does Base64 encoding increase raw file size by ~33%?
Base64 turns every 3 bytes of data into 4 text characters, so the encoded text is about 33% larger than the original file.
Are my uploaded photos or graphics sent to your servers?
No. The encoding and decoding happen in your browser. The image is not sent to our server.