Image to Base64
Convert an image to Base64, Data URI, HTML, CSS, Markdown or JSON.
About this Image to Base64 converter
This tool turns an image into a Base64 text string that you can embed directly in HTML, CSS, Markdown or JSON, with no separate image file to host. The conversion runs entirely in your browser, so your image is never uploaded anywhere.
Which format should I use?
- Raw Base64: just the encoded data, for APIs or your own code.
- Data URI: the Base64 with its
data:image/...;base64,prefix, ready to use as asrcorurl(). - HTML / CSS / Markdown: a ready-to-paste
<img>tag,background-imagerule or Markdown image. - JSON: file name, MIME type and Base64 data in one object.
Good to know
Base64 makes data about 33% larger than the original file, so it works best for small images such as icons, logos and placeholders. Large photos are better served as normal image files. Compressing an image first will give you a shorter string.
FAQ
Is my image uploaded to a server?
No. The file is read locally in your browser and never leaves your device.
Which image formats are supported?
Any format your browser can open, including JPEG, PNG, WebP, GIF and SVG.
Can I convert Base64 back to an image?
Yes. Paste a Data URI into your browser's address bar to view it, or decode the raw Base64 in your code.