To convert an image to Base64, drop it in and copy the result. You can copy it as a data URI, plain Base64, an HTML image tag, or a CSS rule. The Base64 to Image tab turns text back into a picture. It runs in your browser.
What is Base64, and what is a data URI?
Base64 writes binary data, like the bytes of a picture, using ordinary text characters. That lets an image travel through JSON, HTML, CSS, and email. It's an encoding, not encryption, and it makes the data about 33 percent bigger.
A data URI is Base64 with a short label in front, such as data:image/png;base64, so a browser can draw it straight from the text with no separate file.
When should you use Base64 images?
- Small icons and logos in HTML or CSS, loaded with the page.
- HTML emails or single-file demos that need to stay self-contained.
- APIs that expect an image as a text field in JSON.
It's a poor fit for big photos. The string is a third larger than the file and can't be cached separately. Shrink an image first with Image Compressor or Image Resizer, and keep Base64 for images under about 10 KB.
How to convert an image to Base64 and back
- On the Image to Base64 tab, click Select File or drop an image. You'll see a preview, the original size, and the Base64 length.
- Pick an output format, then click Copy to Clipboard to use it in your code.
- To go the other way, open the Base64 to Image tab, paste a string or data URI, and click Download Image.
Notes on decoding
The decoder accepts a full data URI, plain Base64, and URL-safe Base64, with or without line breaks. It detects the image type from the data, so you don't need to know it. If the text isn't valid Base64, it says so. If the string is cut short, you may see only part of a picture.
For a set of website icons, see the Favicon Generator. For choosing an image format, read our image format guide.
Frequently asked questions
How do I convert an image to Base64?
Drop the image into the tool, choose an output format, and click Copy to Clipboard. You can paste it into HTML, CSS, or an API request.
What's the difference between Base64 and a data URI?
Base64 is the encoded text. A data URI is that text with a prefix like data:image/png;base64, so a browser can display it.
Does Base64 make the image bigger?
Yes, by about 33 percent. The page shows both sizes.
What size image should I convert?
Small ones, ideally under 10 KB. Large strings bloat your code and slow pages down.
Is Base64 a way to hide an image?
No. It's easy to decode, so it offers no protection.
Is my image uploaded?
No. Encoding and decoding happen in your browser.