Image tool

Image to Base64 Converter

Convert any image to a Base64 data URL, raw Base64 string, CSS background or HTML img tag in one click — or paste Base64 to preview and download the image — free, private and offline.

100% free No upload — runs on your device Works offline
Drop an image here or tap to choose PNG, JPG, WebP, GIF, SVG · or paste with Ctrl+V · never uploaded

How to convert an image to Base64

  1. Drop a PNG, JPG, WebP, GIF or SVG image into the box.
  2. Pick the output you need: data URL, raw Base64, CSS background or HTML img tag.
  3. Click Copy and paste the snippet into your code. To reverse, switch to Base64 to Image and paste a string.

What is Image to Base64?

Base64 is an encoding that represents binary data, such as an image file, using 64 printable ASCII characters. A data URL wraps that string as data:image/png;base64,… so the image can be embedded directly in HTML, CSS, JSON or email without a separate file request.

Base64 output is about 33% larger than the original file, because every 3 bytes become 4 characters. Embedding is best for small icons and logos (under roughly 10 KB); larger images are usually better served as normal files. This tool reads the file with the FileReader API and shows both sizes so you can decide.

The conversion runs entirely in your browser. Files are never uploaded, and the tool works offline once loaded.

Frequently asked questions

How do I convert an image to Base64?

Drop the image into the tool. It instantly produces a data URL, raw Base64 string, CSS background rule and HTML img tag, each with a Copy button.

Why is the Base64 string bigger than my image?

Base64 encodes every 3 bytes as 4 characters, so the result is roughly 33% larger than the original file, plus a short data URL prefix.

Can I convert Base64 back to an image?

Yes. Switch to Base64 to Image, paste a data URL or raw Base64 string, and the tool shows a preview and lets you download the decoded file.

Which image formats are supported?

Any format your browser can read, including PNG, JPG, WebP, GIF, SVG, AVIF, BMP and ICO. The original MIME type is kept in the data URL.

Is my image uploaded to a server?

No. Encoding and decoding happen locally with JavaScript. Nothing is sent over the network, and it works offline.

Related tools