Skip to content
Free online tool

Image to Base64 converter

Encode an image as a Base64 data URL or a raw Base64 string. Get ready-to-paste CSS and HTML snippets, see the MIME type and encoded size, then copy the result or download it as a text file.

How to convert an image to Base64

  1. Upload an image: PNG, JPG, WebP, GIF, SVG or ICO.
  2. Choose the output: a full Data URL, Raw Base64 text, a CSS background rule or an HTML <img> tag.
  3. Check the MIME type, original size and encoded size.
  4. Click Copy or Download .txt.

What is Base64 image encoding?

Base64 turns binary data, like an image file, into plain text made of letters, numbers and a few symbols. A data URL adds a short prefix such as data:image/png;base64, so browsers know how to display it. You can then place the image directly inside HTML, CSS, JSON or an email template without a separate file.

The encoding is exact: decoding the Base64 gives back the identical original file, byte for byte. Base64 is about 33% larger than the original, which the tool shows clearly. For that reason it’s best for small images like icons, logos and placeholders. Large photos are usually faster to load as normal files, and you will see a tip when an image is above about 200 KB.

When to embed images as Base64

Image to Base64 FAQ

Is my image uploaded?

No. The file is read by your browser and encoded on your device.

What’s the difference between data URL and raw Base64?

Raw Base64 is just the encoded text. A data URL adds the data: prefix and MIME type so it can be used directly as an image source.

Can I convert Base64 back to an image?

Yes. Paste a data URL into your browser’s address bar to view it, or decode raw Base64 text with our Base64 Encoder/Decoder (for text content).

Related tools

More Image Tools

Need another tool?

Browse all 50 free tools for PDFs, images, text, SEO, calculations and development.

Explore All Tools