Account

What new tool do you want?

Image Tools

Image to Base64 / Data URI Converter

Convert images to Base64 data URIs for HTML, CSS and JSON — or paste Base64 to preview and download the image. Runs in your browser.

How to use

  1. 1Drop an image to get its Base64 data URI, plus ready-made HTML and CSS snippets.
  2. 2Or paste a Base64 string to preview it and download the image.

Frequently asked questions

When should I inline images as Base64?

For tiny icons and placeholders, to save a request. Larger images are better as normal files — Base64 is about 33% bigger and can't be cached separately.

Why is the Base64 bigger than the file?

Base64 encodes every 3 bytes as 4 characters, adding about a third to the size.

Is my image uploaded?

No — conversion happens entirely in your browser.

Why Base64 is always bigger than the original file

Base64 exists to represent raw binary data (an image's actual bytes) using only the 64 printable characters that are safe inside text formats like HTML, CSS and JSON. It does this by encoding every 3 bytes of the original file as 4 text characters — a fixed 33% expansion no matter what the image contains. The tool shows this directly: next to the preview it displays the original file size, the resulting Base64 size, and the percentage increase, so the trade-off of inlining versus linking a file is a visible number rather than an abstract rule of thumb.

What decode mode is actually checking

Pasting a Base64 string doesn't require a data URI prefix — the decoder strips a `data:image/...;base64,` header if one is present, but if you paste bare Base64 with no header, it falls back to reading the first decoded byte and matching it against known image file signatures (PNG starts with 0x89, JPEG with 0xFF, GIF with 0x47, and so on) to guess the format before offering a download. If the text isn't valid Base64 at all, it reports that immediately rather than producing a corrupt file.

Example: inlining a small icon versus a product photo

Say you have a 2 KB SVG checkmark icon and a 400 KB product photo, and you're deciding which to inline as CSS background-image values. Running the icon through this tool might show Base64 output around 2.7 KB — a small, one-time cost that saves a separate HTTP request for a tiny asset reused sitewide. Running the 400 KB photo through the same process produces roughly 533 KB of Base64 text embedded directly in your HTML or CSS, which the browser has to re-download in full every time that page loads since inlined data can't be cached separately the way a linked image file can — a clear sign the photo belongs as a normal file, not inlined.

Why this runs entirely client-side

Encoding uses the browser's built-in FileReader to read the file directly into a data URI, and decoding reverses that with a local Base64-to-bytes conversion — neither direction involves a network request, so an image never has to leave your device just to generate a code snippet for it.

Decode guesses the file type from the first bytes

The page opens in encode mode: drop a PNG, JPG, SVG, WebP, or GIF and you get a data URL plus the file name and size, with a copy button. Switch to decode and paste a data URL or bare base64. The preview looks at the start of the bytes to decide what it is, including JPEG, GIF, WebP, and SVG. If those bytes are not something the browser can show, the picture's label changes to Not a displayable image instead of pretending it worked. Encode does not resize or recompress the file; the text is the file you dropped, written out so it can be pasted into a page or a stylesheet.

Related tools

More: Image Tools