Image to Base64 Converter

Turn any image into a Base64 string or a ready-to-use data URI in one click, right in your browser. You can also convert Base64 back into an image.

Image preview

Used when the image is re-encoded as JPG or WebP. A smaller image gives a shorter Base64 string.

Image-
Original file-
Base64 text-

Decoded image preview
Type-
Dimensions-
File size-

Introduction

This free image to Base64 converter changes a picture into plain text that you can paste straight into your code, your stylesheet or an email template. It is useful for developers, bloggers and designers who want to embed a small image without hosting a separate file.

Features

  • Five output types: Copy a full data URI, the raw Base64 text, a ready HTML img tag, a CSS background rule or a Markdown image.
  • Base64 to image: Paste a Base64 string or data URI to preview the picture and download it again.
  • Shrink before encoding: Set a smaller width, format or quality to get a shorter string.
  • Copy and download: Copy the result with one click or save it as a text file.

How to Use the Image to Base64 Converter

  1. Click the upload box, drag your image into it, or paste a picture with Ctrl+V.
  2. Pick the output you need: Data URI, Base64 only, HTML img, CSS or Markdown.
  3. If the text is too long, set a smaller width or choose JPG or WebP with a lower quality.
  4. Click Copy to use the result in your code, or Download .txt to keep it.
  5. To go the other way, open the Base64 to Image tab, paste your text and click Decode image.

Use Cases

Small icons and logos in HTML or CSS

Embed a tiny icon directly in a page or stylesheet so it loads together with the code, without an extra request.

HTML email templates

Some email tools let you place an image inline as a data URI. Test it in your own email client first, because support differs between clients.

Single-file pages and demos

Keep a demo, a report or a small web app in one file by including its images as Base64 text.

APIs and JSON data

Many APIs accept an image as a Base64 string inside a JSON request. Convert your file here and paste the raw text.

Basic Knowledge: What Is Base64?

Base64 is a way of writing binary data, such as the bytes of an image, using only 64 safe text characters: letters, numbers, plus and slash. Because the result is ordinary text, it can travel inside HTML, CSS, JSON or email without breaking.

A data URI wraps that text with a short label that tells the browser what it is. It looks like data:image/png;base64 followed by a comma and the encoded text. A browser reads it like a normal image address, but the picture is inside the address itself.

The trade-off is size. Base64 text is roughly one third larger than the original file, and an inline image cannot be cached on its own the way a separate image file can. That is why Base64 suits small images, and large photos are better served as normal files.

Tips and Common Mistakes

  • Use Base64 for small images only. Icons, logos and tiny graphics are a good fit, while big photos make a page heavy.
  • Shrink first. A smaller width or a WebP version can cut the text length a lot.
  • Copy the whole data URI when you need an image address. Copy Base64 only when an API asks for the raw text.
  • Do not paste extra spaces or quotes inside the text. A single wrong character can break the image.
  • Keep a normal copy of the original file. The Base64 text is hard to edit by hand.

Safety and Privacy

  • Processed in your browser: The conversion happens on your own device, so your image is not sent to our servers.
  • Secure connection: The page is served over HTTPS.
  • Nothing stored: We do not save your pictures or the text. Closing or reloading the tab clears them.
  • No sharing: We do not pass your images to third parties.

Frequently Asked Questions

Is this image to Base64 converter free?

Yes. You can use it as often as you like without paying or creating an account.

What is the difference between Base64 and a data URI?

Base64 is the encoded text itself. A data URI is that text with a short prefix, such as data:image/png;base64, so a browser knows it is an image and can display it directly.

Why is the Base64 text larger than my image?

Base64 stores three bytes of data using four text characters, so the result is about one third bigger than the original file. Shrinking the image first keeps the text shorter.

Which image formats can I convert?

You can convert JPG, PNG, WebP, GIF, SVG and BMP files up to 8 MB. If you re-encode an animated GIF using the shrink options, only the first frame is kept.

Can I turn Base64 back into an image?

Yes. Open the Base64 to Image tab, paste the text or the full data URI, and click Decode image. You can then preview it and download the picture.

Related Tools