Image Tools

Image to Base64

Any image, as Base64 you can paste.

  • Runs in your browser
  • Free, no signup

Choose an image and get its Base64 back. The file is read here in the page — nothing is uploaded, and no copy of the image or the string is kept.

Drag & drop your image here

or

PNG · JPG · WEBP · GIF · SVG · BMP  |  paste with Ctrl+V

One image, up to 6 MB

Your image is read in this browser and never uploaded. No copy of the image or the Base64 string is kept.

A Base64 data URL carries a whole image inside a line of text. That is why a small logo can sit in a stylesheet without a second request, and why an API can accept an attachment as a JSON field with no multipart form at all. It is also about a third larger than the file it represents, which is the trade you are making every time you use one.

This page does the conversion in your browser and shows you the numbers that decide whether it was worth doing: the original size, the encoded size, the character count and the image dimensions. You can take the whole data URL, prefix and all, or just the Base64 payload — the two are not interchangeable, so the page keeps them apart and says which is which.

How to use this tool

  1. Choose an image, or drag one onto the panel, or paste one from the clipboard with Ctrl+V (Cmd+V on a Mac).
  2. Switch the output between Data URL and Raw Base64 depending on where the value is going.
  3. Copy the result, or download it as a .txt file named after the image you chose.

Data URL or raw Base64

They differ by a prefix, and putting one where the other belongs is the most common mistake with Base64. A data URL begins `data:image/png;base64,` and carries its own type, so a browser can use it directly in an `href` or a `src`. Raw Base64 is everything after the comma, which is what an API field or a decoder usually wants.

The page shows you both from the same file, so you can see exactly what the difference is rather than guessing. Switching between them does not re-read the image.

What Base64 does to the size

Every three bytes become four characters, so the encoded form is roughly 33% larger than the file. A 60 KB PNG becomes about 80 KB of text, and gzip brings much of that back for text formats — which is why a data URL in a compressed stylesheet costs far less than it looks like it should.

The limit on this page is deliberately below the site's normal image limit. Twenty-five megabytes of photograph becomes thirty-three megabytes of characters in a text box, and the tab stops responding long before anything is refused. Six megabytes is generous for the job a data URL actually does.

SVG, and why the preview is an image

An SVG is text that can contain script, so a page that displays one carelessly can end up running it. The preview here is drawn through an `<img>`, which treats an SVG as a static picture and does not run anything inside it — and the decoded data is never inserted into the page as markup.

The same rule applies in the other direction, on the Base64 to Image page: the bytes are checked against the real image signatures before anything is shown, so a string that decodes to something other than an image is refused rather than previewed.

Frequently asked questions

Is my image uploaded?

No. The file is read with the browser's own FileReader and never leaves the page. Nothing is stored, and no copy of the image or the string is kept.

What is the difference between Base64 and a data URL?

A data URL is a prefix plus Base64. The prefix names the type — data:image/png;base64, — so a browser knows what the bytes are. Raw Base64 is the payload on its own, which is what a decoder or an API field normally expects.

Is Base64 encryption?

No. It is a way of writing bytes down using 64 printable characters, and anyone holding the output can recover the file with no key. It makes data safe to transport, not safe to read.

Why is my Base64 larger than the file?

Three bytes become four characters, so the encoded text is about 33% bigger. That is inherent to the encoding, not a setting.

Can I convert a PDF or a video?

Not here. This page handles images — PNG, JPG, WEBP, GIF, SVG and BMP. Other types have their own pages, and Base64 of a large binary is rarely what you actually want.