Image to Base64 Converter

Turn an image into text you can embed directly in code.

Loading tool...

How to use Image to Base64 Converter

  1. Choose an image.
  2. Copy the data URL, HTML tag or CSS snippet.
  3. Paste it into your page or stylesheet.

About this tool

A data URL stores the whole file inside a string, so it needs no separate request. It is useful for small icons, email templates and single-file pages. Base64 makes the data about 33% larger, so keep it for images under a few kilobytes and use normal files for anything bigger.

The snippets include a data URL, an HTML <img> tag and a CSS background-image rule.

Frequently Asked Questions

Is Base64 good for performance?
Only for very small images. Large inline images slow down page parsing and cannot be cached separately.
How do I turn Base64 back into an image?
Use the Base64 to image converter.

Related tools