Skip to content
freeonlinefileconvert

Image to Base64

Turn an image into a Base64 string you can paste straight into HTML, CSS, JSON or an email template.

or drop it here · up to 50 MB, free

Bigger files? Pro converts files up to 500 MB

This is bigger than the free version

You can still do it: convert it now and pay €1.99 only if you want to download the result.

Free covers files up to 50 MB and up to 20 files at a time.

Need it the other way round?Base64 to Image

Free · No sign-up · No watermark · Your files never leave your device

Image to Base64 in 3 steps

  1. Select your image, or drop it on the box.
  2. Choose the output: data URI, plain Base64, CSS or an HTML tag.
  3. Click Convert to Base64, then copy the code or download it as a .txt file.

When to embed an image as Base64

Base64 writes the bytes of a file as plain text, so an image can live inside an HTML page, a stylesheet, a JSON payload or an email signature instead of being a separate file. That saves a request for small icons and logos, and it is the only way to send an image through some APIs and form fields that accept text alone.

The price is size: Base64 text is about a third bigger than the image, and it cannot be cached on its own. Use it for images of a few kilobytes and keep photos as normal files. For the smallest code, compress the image first, or use SVG for logos and icons, which also stay sharp at any size.

Frequently asked questions

How do I convert an image to Base64?

Select an image here, choose the output format and click Convert to Base64. The code appears in a box with a Copy button, and you can also download it as a .txt file. It works with JPG, PNG, GIF, WebP, SVG, AVIF, BMP and ICO images.

What is a data URI?

A data URI is the Base64 text with a short prefix that tells the browser the file type, such as data:image/png;base64, followed by the code. You can use it anywhere a URL to an image is expected, for example in the src of an img tag or in CSS url().

How do I use Base64 in HTML or CSS?

Choose "HTML <img> tag" to get a ready-made img element, or "CSS background-image" to get a line you can paste into a style rule. Both contain the full data URI, so the image shows without a separate file.

Why is the Base64 bigger than the image?

Base64 uses 4 text characters for every 3 bytes, so the code is about 33 percent larger than the file. That is fine for small icons but adds up quickly for photos. Compress or resize the image first if the code is too long.

Is my image uploaded to a server?

No. The image is read and encoded inside your browser on your own device, so it is never sent to us or stored anywhere. Once the page has loaded, the tool keeps working even without an internet connection.

Related tools

You are one of the first

FreeOnlineFileConvert has just launched. Create a free account now and join our Family & Friends list: the full Pro plan, free for life.

Pro0 €6,99 €
Join for free