Image to Base64 Converter

Convert images to Base64 encoded strings for embedding in HTML, CSS, or JSON

Advertisement

Drag & drop an image here, or click to select

Supports JPG, PNG, GIF, SVG, WebP (Max: 5MB)

Advertisement

About Image to Base64 Converter

Our Image to Base64 Converter tool helps you convert images to Base64 encoded strings. This is useful for embedding images directly in HTML, CSS, or JSON without requiring a separate file.

Base64 is a binary-to-text encoding scheme that represents binary data in an ASCII string format. It's commonly used to embed image data in web pages, CSS files, or JSON data.

With our tool, you can:

  • Convert any image to a Base64 encoded string
  • Get the Base64 data with or without the Data URL prefix
  • Preview the image before and after conversion
  • Copy the Base64 string to clipboard for use in your projects
  • Convert images from your device or from a URL

How to Use Base64 Images

In HTML:

<img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD..." alt="Base64 Image" />

In CSS:

.element {
  background-image: url("data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD...");
}

In JavaScript:

const img = new Image();
img.src = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD...";
document.body.appendChild(img);

Frequently Asked Questions