Skip to content
APK Peer

Image to Base64 Converter

Free · runs in your browser · nothing uploaded

Quick answer

This tool converts an image into Base64 text, ready to embed directly in HTML, CSS, JSON or email templates. Choose a full data URL, raw Base64, a CSS background rule or an HTML img tag, and copy it in one tap. It also shows how much larger the encoded version is, so you can decide whether embedding makes sense.

Small images (icons, logos) work best. Nothing is uploaded.

How to convert an image to Base64

  1. Tap Choose an image or drag one onto the box.
  2. Choose the output format: Data URL, Base64 only, CSS or HTML img.
  3. Tap Copy and paste it into your code.

The tool shows the original file size and the size of the encoded text, so you can see the overhead.

Output formats

FormatLooks likeUse it in
Data URLdata:image/png;base64,iVBOR…Anywhere an image URL works
Base64 onlyiVBOR…JSON, APIs, databases
CSSbackground-image: url("data:…");Stylesheets
HTML<img src="data:…" alt="">Web pages and HTML emails

When embedding images makes sense

Embedding an image as Base64 puts the image data inside your HTML, CSS or JSON instead of in a separate file. That can be useful for:

  • Small icons and logos in a single-file page or widget.
  • HTML email signatures, where external images may be blocked.
  • APIs and JSON that need to carry an image as text.
  • Offline pages that must work without loading other files.

When it doesn't

Base64 makes files about a third larger, and embedded images can't be cached separately by the browser. For large photos, or images used on many pages, a normal image file loads faster. As a rule of thumb, embed images under about 10 KB and link to anything bigger.

Before embedding, shrink the image with the image compressor or image resizer to keep the encoded text short.

Decoding Base64 back into an image

Paste a full data URL into your browser's address bar and press Enter: the image opens, ready to save. For text rather than images, use the Base64 encoder and decoder.

The image is read in your browser and never uploaded.

Frequently asked questions

What is a data URL?

A data URL contains the file itself, encoded as text, instead of pointing to a file on a server. It starts with data:image/png;base64, followed by the Base64 data, and can be used anywhere a normal image URL works.

When should I embed images as Base64?

For small images such as icons and tiny logos, embedding saves a separate network request. For larger images it's usually worse, because Base64 is about a third bigger and can't be cached separately.

Can I convert Base64 back into an image?

Yes. Paste a full data URL into your browser's address bar and the image opens, ready to save. To decode Base64 text rather than images, use the Base64 encoder and decoder.

Last updated by the APKPeer Editorial Team. Read our privacy policy for how the site handles data.