FileToolsHub logo

Image to Base64

Encode an image as a data URI or raw Base64 in the browser, without uploading the file.

Processing: runs in your browser, nothing uploaded

About Image to Base64

HTML and CSS sometimes need a picture inline, as a data URI, instead of a separate file. Image to Base64 reads the image on your machine and gives you that string.

Data URI or raw Base64

The reader produces a data URI: the media type, a comma, then the Base64. Leave “Data URI” on when you are pasting into an img src or a CSS url(). Switch to “Raw Base64” when an API wants only the payload after the comma. The character count under the output is the string you are about to copy. A photo that looks small on screen can still be hundreds of kilobytes of text. Inline images of that size slow a page down. Prefer a normal file URL for anything larger than a logo or icon.

What you can drop in

The drop zone accepts an image, and the hint lists JPG, PNG, GIF, and WEBP. The file never goes to the server. Base64 to Image is the reverse: paste a string or a data URI and download a picture. JPG to PDF, PDF to JPG, and Images to PDF are for documents, not for embedding a string in markup. This encoder does not resize, strip metadata, or change format before encoding. The bytes in the file are the bytes in the string.

When not to inline

Email clients and some CMS fields reject long data URIs or strip them. A GIF animation encoded this way is still a GIF in the string, but many places that want Base64 really wanted a static PNG. If the next system asked for a file, a string is the wrong shape of answer and you should skip this page. Icons and tiny logos are the cases where inlining pays off. A photo belongs in a normal image URL.

How to use

  1. 1

    Drop an image. JPG, PNG, GIF, and WEBP are the formats the zone calls out.

  2. 2

    Choose Data URI or Raw Base64.

  3. 3

    Copy the string. Check the character count before you inline it in a page.

Privacy

The browser reads the file locally. The image is not uploaded.

Frequently asked questions

What is the difference between data URI and raw Base64?

A data URI includes the media type and a comma. Raw Base64 is only the payload after that comma.

Which images can I encode?

An image file the browser can read. The drop zone calls out JPG, PNG, GIF, and WEBP.

Will a large photo make a huge string?

Yes. The character count is shown above the output. Inline that string only for small assets such as icons.

How do I turn the string back into a file?

Paste it into Base64 to Image and download the picture.

Browse all Image Tools · Sitemap