1. Home
  2. Convert
  3. Image to Base64
Convert

Image to Base64 converter

Encode images as Base64 data URIs and copy ready-to-paste code for HTML, CSS, JSON or email templates.

How to convert an image to Base64

Add an image

Drop or paste an image. Small icons and logos work best.

Choose output

Data URI, raw Base64, a CSS background rule or a complete HTML tag.

Copy or download

Copy the code to your clipboard with one click or download it as a text file.

What is Base64 image encoding?

Base64 is a way to represent binary data — like an image — using only 64 plain text characters. A Base64 image can be placed directly inside HTML, CSS, JSON or JavaScript as a data URI, so the browser does not need to make a separate request to download it.

A data URI looks like this: data:image/png;base64,iVBORw0KGgo…. The first part tells the browser the file type; the rest is the encoded image.

When should you use Base64 images?

  • Small icons and logos (under ~5 KB) — saves an HTTP request.
  • HTML email templates — some email clients block external images but show embedded ones.
  • Single-file HTML documents, reports and offline pages.
  • APIs and JSON — sending an image as a text field.

When you should not

Base64 makes data about 33% larger than the original file and the image cannot be cached separately by the browser. For large photos, a normal image file is faster. Compress big images first with reduce image size in KB, or convert them to an efficient format.

Output formats

  • Data URI — use it in src, href or url().
  • Base64 only — the raw string without the prefix, for APIs and databases.
  • CSS background — a ready background-image rule.
  • HTML <img> — a complete tag with width and height for better page layout.

Frequently asked questions

Does Base64 increase the file size?

Yes, Base64 text is about 33% larger than the binary file. It is best for small images such as icons and logos.

Can I convert SVG to Base64?

Yes. SVG files are encoded as data:image/svg+xml;base64 and work in HTML and CSS.

How do I decode Base64 back to an image?

Paste the data URI into your browser’s address bar and press Enter — the image will open, and you can save it.

Are my photos uploaded to your server?

No. All processing happens locally in your web browser using JavaScript. Your images never leave your device, which is why the tool works so fast and is safe for personal documents and ID photos.