Image to Base64 Converter

Turn an image into Base64 code you can paste into HTML or CSS.

Your image

Upload an image to encode

Drop an image here

Size-
Dimension-
Type-
Overhead0%
Base64 output

Ready for CSS

Use the code as a CSS background image, with no separate file to load.

Ready for HTML and JSON

Store small images as text, for example in JSON.

Embed images inline

Embed small images directly in HTML or CSS to save a request. Base64 text is about a third larger than the original file.

Image to Base64 FAQ

Why is Base64 larger than the image?

Base64 encoding maps 3 bytes of binary data into 4 ASCII characters. This results in an approximate 33.3% increase in size compared with the original file, so it suits small icons best.

Why use Base64?

An inline image needs no extra request, which can help for very small icons. For larger images a normal file is usually faster.

How to use the Image to Base64

  1. Choose or drop an image.
  2. Wait for the Base64 data URI to appear.
  3. Copy it into your HTML, CSS or JSON.

Questions and answers

Are my files uploaded to a server?

No. The file is read and processed in your browser, and the tool does not send it anywhere.

Why is the Base64 text larger than the image?

Base64 uses four characters for every three bytes, so the text is about a third larger than the file.