Image to Base64 Converter

Drag and drop an image here or click to upload

Base64 is generated automatically after selecting or dropping an image.

How to Use

  • Click the "Drag and drop an image here or click to upload" area above, or drag and drop an image file directly into that area.
  • You can also click the "Load Sample Image" button to see a preset small image and its Base64 encoding.
  • Once the image is uploaded, you will see a preview, file information, and three formats of Base64 encoding below: Raw Base64, CSS background image format, and HTML image tag.
  • Each format of Base64 encoding can be copied using the adjacent "Copy" button.
  • For the HTML image tag, you can directly edit the code in the textarea and see the effect using the "Preview" button.

What is Image Base64 Encoding?

Image Base64 encoding is the process of converting the binary data of an image file into a text string composed of 64 printable characters. This encoding allows image data to be embedded like text within HTML, CSS, JSON, or other text-based formats, eliminating the need for an external image file.

The main advantages are reducing HTTP requests (if the image is small) and ensuring the image is transferred along with the style/markup. The disadvantage is that Base64 encoded data is typically about 33% larger than the original binary data, making it unsuitable for large images.