← Blog · Utilities · 2026-07-12

How to Convert an Image to Base64 (and Back) | Bsbshs

Open the tool →

Developers often need an image as a Base64 string to embed directly in HTML, CSS, or JSON. Here's how to convert an image to Base64 and decode it back, free and privately.

What is Base64?

Base64 is a way of representing binary data — like an image — as plain text. Embedding a small image as a Base64 string means it loads with your code, with no separate file request. It's handy for icons, small logos, and inline assets.

How to convert an image to Base64

  1. Open the Base64 tool and add your image.
  2. Copy the generated Base64 string (or the ready-made data URI).
  3. Paste it into your HTML, CSS, or JSON.

How to decode Base64 to an image

Paste a Base64 string (or data URI) into the tool and it renders the image back, ready to download. This is useful for checking what an encoded string contains.

Base64 makes files about a third larger, so it's best for small images. For big pictures, a normal image file is more efficient.

Do it privately

A browser-based converter encodes and decodes on your device, so your image is never uploaded.

Frequently asked questions

How do I convert an image to Base64?

Add the image to the tool and copy the generated string or data URI.

Can I decode Base64 back to an image?

Yes, paste the string and download the image.

When should I use Base64?

For small inline images in code; large images are better as normal files.

Is it free and private?

Yes — free and nothing uploaded.

Summary

Converting an image to Base64 lets you embed it directly in code, and decoding turns a string back into an image. Best for small assets, it's free and private in your browser.

Open the tool →

Related guides

Compress an imageConvert PNG to JPGCreate a strong password