Image to Base64 Converter
Turn an image into a Base64 string or data URI you can paste straight into HTML, CSS or JSON. Copy the plain Base64, an <img> tag or a CSS background. Need the reverse? Decode Base64 back to an image below.
- Data URI, HTML and CSS
- Base64 to image too
- Any image type
- Private, no upload
Base64 to image
Download imageHow to use
- Choose an image or drop it on the box.
- Copy the format you need: data URI, Base64 only, an HTML img tag or a CSS background.
- To go back, paste a Base64 string in the second box and see the picture.
- Press Download image to save it.
What is a data URI?
A data URI puts the file inside the text of a page, in the form data:image/png;base64,.... The browser shows the image without another request. It is handy for small icons, email templates and single-file pages. The Base64 text is about 33% larger than the original file.
When to avoid it
Do not inline large photos: the page gets heavy and the image cannot be cached on its own. Compress the image first with the image compressor. For JSON data, try the JSON formatter.
Frequently asked questions
How do I convert an image to Base64?
Choose the image above. The Base64 string and the data URI appear straight away, ready to copy.
Is the image uploaded?
No. It is encoded in your browser.
Why is the Base64 bigger than my file?
Base64 turns every 3 bytes into 4 characters, so the text is about one third larger.
Can I decode Base64 back to an image?
Yes. Use the second box on this page and paste the string, with or without the data: prefix. Without a prefix it is treated as PNG.