Image to Base64 Converter (Free)

Base64 turns bytes into text so an image can travel inside HTML, CSS, JSON or a configuration file instead of as a separate request. The conversion is mechanical and predictable: the payload grows by exactly one third, a short header is added, and the result is a very long line of characters. The numbers below come from three real files pushed through the tool, and one detail about the output box is worth knowing before you try to copy it.

Try the free tool now

100% in your browser — no upload, no account, no watermark.

Open Image to Base64 Converter - Data URIs, With the Real Numbers

What a data URI contains

The output has two parts. The header states the media type and the encoding, for example data:image/jpeg;base64, which is 23 characters. Everything after the comma is the file itself, encoded with the standard Base64 alphabet: 64 symbols, four characters for every three bytes of input.

That ratio is where the one-third increase comes from. Three bytes become four characters, so a file of n bytes produces about 4n/3 characters, rounded up to a multiple of four with padding. There is no compression step and no quality loss; the bytes are the same, written in a different alphabet.

The result is text, which means it can be pasted anywhere text is accepted: an img src attribute, a CSS url(), a JSON string, a Markdown file, a database column.

The preview stops at 20,000 characters

Base64 output is long, so the tool shows the first 20,000 characters in a scrollable box and reports the full length separately. That is a display limit, not a conversion limit. The copy button copies the entire string, and the download writes the complete value to a .txt file.

This matters if you select the text with the mouse instead of using the button: dragging inside the box can only capture what is rendered, and the result will be a truncated data URI that fails to load. Use Copy, or download the text file, and the full payload comes with it.

Three files, measured

The character counts below are the exact lengths of the produced strings, read in Chrome on 7 November 2026. The tool's own KB figure is that length divided by 1024:

SourceFile bytesBase64 charactersShown as
Photo, 4000x3000 JPG1,360,3391,813,7881771.3 KB
Screenshot, 1920x1942 PNG197,518263,360257.2 KB
Logo, 2048x2048 PNG129,117172,156168.1 KB

Each character count is exactly four thirds of the file size, as the arithmetic predicts. Multiply the photo's 1,360,339 bytes by 4/3 and the result is 1,813,785, with three characters of padding to reach the next multiple of four.

Where embedding an image pays off

  • A small icon or logo used in one stylesheet. One request saved, and the CSS stays self-contained.
  • A single-file HTML document that must work when moved around without its assets.
  • A template or test fixture where an external URL would be fragile or unavailable.
  • A signature or avatar in a generated document, where the image has to travel with the text.

Base64 is a packaging decision, not an optimisation: it enlarges the payload and moves the cost into the document that contains it.

Where it goes wrong

  • Large photographs. A 1.36 MB JPG becomes 1.81 million characters, inflating the HTML or CSS that carries it and forcing the browser to hold the whole string in memory.
  • Images repeated across pages. A separate file is cached once; an inline data URI is downloaded again with every document that embeds it.
  • Content security policies that forbid data: sources. The image will be blocked with no visible clue why.
  • Anywhere a human has to read the output. Base64 is not meant to be inspected, diffed or merged.

There is also no way to update the image without editing the document that contains it. For a favicon that changes once a year, that is fine; for a photo that changes weekly, it is a maintenance problem.

Converting an image to Base64

  1. Open the Image to Base64 tool.
  2. Drop a JPG, PNG, WebP or GIF file, up to 20 MB.
  3. Wait for the data URI to appear in the output box.
  4. Read the reported length before deciding whether to embed it.
  5. Use Copy for the full string, or download the .txt file.
  6. Paste it where the image should appear, keeping the header intact.

The file never leaves the browser: it is read with the browser's file reader and encoded locally. The free allowance is 20 conversions per day per browser, and a Pro key removes that ceiling on the browser where it is activated.

About this guide

Written by
The ImageTools Pro team
Last reviewed
October 2026
How we test
Steps run in a real browser on real PNG, JPEG and WebP files

We revise this page whenever browser APIs, format support or recommended settings change. Corrections are welcome — tell us from the contact page.

Tools we recommend

Frequently Asked Questions

How much larger does Base64 make an image?

About 33%, plus the header. Four characters encode three bytes, so a 1,360,339-byte JPG became 1,813,788 characters, and a 23-character prefix is added for a JPEG data URI.

Why does the output box stop at 20,000 characters?

That is a display limit, not a conversion limit. The box shows the first 20,000 characters; Copy and Download use the complete string.

Can I use a data URI for any image size?

Technically yes, but practically no. A 1.36 MB photo produces 1.81 million characters, which is a poor fit for HTML or CSS. Reserve data URIs for small icons and self-contained documents.

Ready to try it?

All tools are free and run entirely in your browser.

Open the tool now

We value your privacy

This site is ad-supported by a partner that may set a cookie to personalize ads. Reject and no third-party ad scripts load at all. All image processing stays 100% in your browser either way.