Image to Base64 Converter

Turn an image into a data URL you can paste into code.

Runs in your browser Free · no accountFile upload supported

File

Result

Your converted file will appear here.

This conversion happens locally in your browser. Your files are never uploaded.

About the Image to Base64 converter

A data URL embeds the image itself into your markup or stylesheet, so the browser needs no extra request to display it. Paste it into an `img` tag, a CSS background, or a JSON field.

The encoding happens in your browser, which matters — an image you are embedding is often a logo or an asset you would rather not upload to a third party.

When embedding is worth it

Small assets that appear on every page — an icon, a tiny texture, a placeholder — are good candidates. You trade a slightly larger HTML or CSS file for one fewer network round trip.

Anything above roughly 5 KB is usually a bad trade. Data URLs cannot be cached separately from the document that contains them, so a large embedded image is re-downloaded with every page load.

The 33% overhead

Base64 encodes 3 bytes as 4 characters, so the text is about a third larger than the file. Compress the image before encoding — the overhead applies to whatever you feed in.

SVG is a special case

SVG is text already, so it can be embedded URL-encoded rather than Base64-encoded, which is smaller and stays readable. Base64 works too and is more robust against escaping mistakes.

Frequently asked questions

Why is my data URL so long?

Because the whole image is in it. Compress or resize the image first — a 200 KB photograph becomes roughly 270 KB of text.

Do data URLs work in email?

Inconsistently. Gmail and Outlook block them in many contexts. Host the image and link to it instead.

Can I decode it again?

Yes, the Base64 to Image converter takes a data URL or a raw string and gives you the file back.