Image to Base64 Converter (and Base64 to Image)

Convert any image to Base64 text that you can paste straight into HTML, CSS, JSON or an email template. Choose a data URL, raw Base64, a ready-made <img> tag or a CSS background rule. You can also paste Base64 text to turn it back into an image and download it.

Choose an image or drag and drop it here
You can also paste an image with Ctrl+V. JPG, PNG, WebP, GIF and more.

–Image size
–Base64 length
Choose an image to start.

Base64 to image

Images are processed in your browser. Nothing is uploaded to or stored on our server.

Quick answer: Choose an image and its Base64 data URL appears in the box, starting with data:image/png;base64,. Paste it into an src attribute or a CSS url() and the image shows without a separate file.

How to convert an image to Base64

  1. Click the box to choose an image, drag one in, or paste a screenshot.
  2. Pick the output: a data URL, Base64 only for APIs and JSON, a complete HTML img tag, a CSS background-image rule or Markdown.
  3. Click Copy output and paste it into your code.
  4. To go the other way, paste Base64 text or a data URL in the lower box and click Show image, then download it.

What is a Base64 image?

Base64 is a way to write binary data, such as an image file, using only 64 safe text characters: A to Z, a to z, 0 to 9, + and /. A data URL wraps it with the file type, for example data:image/jpeg;base64,/9j/4AAQ.... Browsers treat that text exactly like an image file, so you can put small images directly inside HTML, CSS, SVG, JSON or email code.

When to use Base64 images

  • Good for: tiny icons, logos and placeholders under a few kilobytes, HTML emails that block external images, single-file HTML reports, and APIs that accept images as text.
  • Not ideal for: photos and large images. Base64 is about 33 percent bigger than the file, cannot be cached separately, and makes your HTML or CSS slower to download and parse.

How to recognise the image type

Base64 starts withImage type
/9j/JPEG
iVBORw0KGgoPNG
R0lGODGIF
UklGRWebP
PHN2Zy or PD94bWwSVG

Shrink the image first with the image compressor or image resizer to keep the Base64 short. To encode text instead of images, use the Base64 encoder and decoder.

FAQ

Is there a size limit?

Browsers handle data URLs of several megabytes, but keep inline images small for speed.

Is my image uploaded?

No. The conversion runs in your browser.

More free tools

See all of them on the QuickOnlineTips free online tools page and play our free online games.

Found this useful? Share it with someone who needs it.