Skip to content

Image to Base64

Convert JPG, PNG, WebP, GIF or SVG images to Base64 or a Data URL, with ready-to-paste HTML, CSS and JS.

AvailableRuns in your browserFree · No sign-up

Image to Base64

Base64 is about 33% larger than the file. Strings over a few MB are slow to paste into code and inflate pages.

Output

Your images are processed locally in your browser. They are not uploaded to OZVILO servers.

How to use the Image to Base64

  1. 1Choose or drop a JPG, PNG, WebP, GIF or SVG image.
  2. 2Pick Data URL (with the data:image/… prefix) or raw Base64 output.
  3. 3Check the original size, the Base64 size and the size increase.
  4. 4Copy the result or a ready-made HTML, CSS or JavaScript snippet, or download it as a .txt file.

Examples

  • Small PNG icon

    Input
    icon.png · 1,200 bytes
    Result
    Raw Base64: iVBORw0KGgo… (1,600 characters, +33.3%)
  • HTML snippet

    Input
    logo.svg
    Result
    <img src="data:image/svg+xml;base64,…" alt="logo">

Image to Base64 features

  • Detects the real image type from the file's bytes, not its name, for a correct MIME type
  • Data URL or raw Base64 output, encoded with the browser's native FileReader
  • Original size, Base64 size, character count and size increase
  • Copy-ready HTML <img>, CSS background-image and JavaScript snippets
  • Long results are shortened on screen, but Copy and Download always give the full text

Frequently asked questions

Why is the Base64 version bigger?

Base64 uses 4 text characters for every 3 bytes, so the result is about 33% larger than the file (plus a short prefix for Data URLs).

When should I embed images as Base64?

For small images such as icons, where saving an extra request matters. Large images are better served as normal files, which browsers can cache separately and load in parallel.

Is it safe to convert SVG files?

SVG files can contain scripts. The preview here displays the SVG as an image, which never runs scripts, and the same applies when you use the Data URL in an <img> tag or CSS. Only use SVGs from sources you trust if you embed them in other ways.

Is there a size limit?

The default limit is 10 MB, and you can raise it to 25 MB. Very long Base64 strings are slow to paste and edit, so smaller images work best.