Image to Base64

Image to Base64 encodes a PNG, JPG, GIF, SVG or WebP into a Base64 data URI you can embed directly in HTML, CSS or JSON — no separate file request needed.

Drop or pick an image and the tool gives you the full data URI, the raw Base64 payload, or a ready-to-paste CSS background rule. Everything is processed in your browser, so your images are never uploaded.

Drag & drop an image here

or click to choose a file — PNG, JPG, GIF, SVG, WebP…

How to use Image to Base64

  1. 1

    Add an image

    Drag and drop an image onto the box, or click to choose a file from your device.

  2. 2

    Pick an output format

    Switch between Data URI, Raw Base64, and CSS background depending on where you will paste it.

  3. 3

    Copy and embed

    Copy the output and drop it into an <img src>, a CSS url(), or a JSON field.

When to inline images as Base64

Inlining an image as a data URI removes a network request, which can speed up the first paint for tiny, critical assets like icons and logos. It is also handy for self-contained HTML emails and single-file demos.

The trade-off is size and caching: Base64 is about 33% larger than the binary file, and an inlined image cannot be cached separately by the browser. For anything beyond small assets, a normal image URL is usually better.

Data URI, raw Base64 and CSS

A data URI bundles the MIME type and the Base64 payload together — `data:image/png;base64,…` — and is what you put in an img src or a CSS url(). The raw Base64 is just the payload, useful when an API or config wants the bytes without the prefix.

The CSS option wraps the data URI in a `background-image: url("…")` declaration so you can paste it straight into a stylesheet.

Frequently asked questions

Which image formats are supported?
Any image your browser can read — PNG, JPG, GIF, SVG, WebP and more. The MIME type is taken from the file itself.
Are my images uploaded?
No. The file is read locally with the browser's FileReader, so it never leaves your device.
Why is the Base64 larger than my image?
Base64 encodes three bytes into four characters, adding roughly 33% overhead. That is expected and is the cost of embedding binary data as text.

Last updated: