Image to Base64

Turn an image into Base64 text for websites, emails and apps. Your image never leaves your device.

Preview
This image is large. Consider compressing it first for a shorter Base64 string.

About Image to Base64

Image to Base64 converter showing data URI, HTML and CSS code

Image to Base64 turns a picture into text that can be pasted directly into HTML, CSS, emails or JSON. You get the full data URI, the raw Base64 string, a ready HTML img tag and a CSS background rule, each with a copy button.

The conversion runs inside your browser, so the image is not uploaded. Base64 text is about one third bigger than the original file, so it is best for small images such as icons and logos.

Key features

When do you need this?

Common mistakes to avoid

How to use

  1. Select an image (JPG, PNG, WEBP, GIF, SVG).
  2. The Base64 data URI, raw Base64, HTML tag and CSS code appear instantly.
  3. Press Copy next to the format you need.
  4. Optionally download the Base64 text as a .txt file.
اردو میں طریقہ:
  1. تصویر منتخب کریں (JPG, PNG, WEBP, GIF, SVG)۔
  2. Base64 ڈیٹا URI، خام Base64، HTML ٹیگ اور CSS کوڈ فوراً نظر آ جاتا ہے۔
  3. جو فارمیٹ چاہیے اس کے ساتھ "Copy" دبائیں۔
  4. چاہیں تو Base64 ٹیکسٹ کو .txt فائل میں ڈاؤن لوڈ کریں۔

Tips

Base64 text is about 33% bigger than the image, so use it only for small images and icons.
Compress the image first if the Base64 text is very long.
Data URIs work directly inside src="" and CSS url().
Do not paste very large Base64 strings into emails; many email apps block them.

Frequently Asked Questions

Base64 is a way to write binary data like an image as plain text so it can be placed directly inside HTML, CSS or JSON.

A data URI is Base64 text with a prefix such as data:image/png;base64, so a browser can show the image without a separate file.

Base64 needs about 33% extra space.

No. The conversion runs inside your browser.

More free tools