BASE64 ENCODER

Image to Base64

Upload a JPG, PNG, or WebP and get a Base64 string or Data URL instantly. Copy to clipboard with one click.

BASE64 ENCODER

☞ runs entirely in your browser — nothing is uploaded

Drop your image here

or click to browse — JPG, PNG, WebP

embed images in code

Encode images as Base64 online

Base64 rewrites binary data as ASCII text so an image can live inside HTML, CSS, JSON or an email template with no separate file to fetch. The cost is size: three bytes become four characters, so the encoded string is about a third larger than the file it came from, before the data URL prefix.

That trade is worth it for a handful of small assets — an icon, a 1×1 spacer, a logo in an email where remote images are blocked by default. It is a bad trade for anything large, because an inlined image cannot be cached separately, cannot be lazy-loaded, and has to be re-downloaded with every copy of the document that carries it.

three steps

How to convert an image to Base64

01

Upload

Drop or select a JPG, PNG or WebP. The file is read with FileReader in the browser — nothing is sent anywhere, which matters when the image is a signature or an internal screenshot.

02

Copy the right form

The full data URL carries its own MIME type and goes straight into markup. The raw Base64 payload is the same bytes without the prefix, which is what most JSON APIs and mail libraries expect.

03

Paste it

Into an img src, a CSS url(), or a request body. Compress or resize the image first if the string looks alarming — the encoding cannot make a large file small.

quick answers

Image to Base64 FAQ

What is a data URL?

A data URL wraps the Base64 payload with a MIME prefix such as data:image/png;base64, so a browser can render it directly from the markup instead of requesting a file.

How much larger does Base64 make my image?

About 33% larger, because every three bytes become four ASCII characters. Gzip on the wire recovers part of that but not all of it, since Base64 output compresses worse than the binary it encodes.

When should I not inline an image?

When it is more than a few kilobytes, when it appears on more than one page, or when it is below the fold. An inlined image is re-sent with every copy of the document and cannot be cached, lazy-loaded or served in a different format per browser.

Should I use the data URL or the raw Base64?

Data URL for HTML and CSS, where the MIME prefix is what tells the browser how to decode it. Raw Base64 for JSON fields and mail libraries, which usually declare the content type separately and choke on a duplicated prefix.

Does it work for SVG?

This page takes JPG, PNG and WebP. For vectors use the SVG to Base64 tool, which also offers the URL-encoded form — for SVG that is smaller and stays readable, unlike Base64.

Why did the copy button do nothing?

The clipboard API only works on a secure origin. On HTTPS it is fine; on a plain HTTP page some browsers block it silently. Select the output text and press Ctrl+C or Cmd+C instead.

Is my image uploaded?

No. Encoding happens entirely in your browser with FileReader, and the page works offline.

Is this tool free?

Yes — free, no sign-up, no watermark.