Skip to content
TheFilesGuy
en
Menu

jpg · png · webp · heic

Image to Base64

Turn an image into a Base64 data URI you can paste into code.

Files never leave your device.

Options

Base64 is about a third larger than the file, so it suits small images such as icons.

  • No sign-up
  • No upload queue
  • No watermark
  • Works offline after first visit

About Image to Base64

Embedding a small image directly in HTML, CSS, JSON or an email template avoids an extra file and request. To do that, the image has to be written as Base64 text, usually as a data URI. This tool encodes PNG, JPG, SVG, GIF, WebP, ICO and other images and gives you the result as a full data URI, plain Base64, a ready-made CSS background-image rule or an HTML img tag. Copy it with one click or download it as a text file.

How to Use It

  1. 01

    Add an image

    Drop a PNG, JPG, SVG or other image into the box.

  2. 02

    Pick the output

    Choose data URI, plain Base64, CSS or HTML.

  3. 03

    Copy or download

    Press Encode, then Copy the text or download it as .txt.

Questions

When should I use Base64 images?

For small images such as icons and logos under a few kilobytes. Larger images are better as normal files, because Base64 is about a third bigger and can't be cached separately.

What is a data URI?

A string that starts with data:, the file type and ;base64, followed by the encoded image. Browsers treat it like an image URL.

Is the image changed?

No. The original file bytes are encoded exactly, so decoding gives back the identical file.

Is my image uploaded?

No. The encoding happens in your browser.

See all image converters

Learn More