Free browser tool

Image to Base64

Encode any image as a Base64 data URI, with ready-to-copy HTML and CSS snippets — right in your browser, with nothing uploaded.

100% private.Your images are processed entirely in your browser using the Canvas API. Nothing is uploaded to a server — the files never leave your device.

Drop an image to encode

or click to browse — PNG, JPG, WebP, SVG, GIF

Quick answer

An image to Base64 encoder turns a picture into a long text string called a data URI, which you can paste directly into HTML or CSS instead of linking to a separate file. Drop an image above and this tool gives you the full data URI plus ready-made <img> and CSS background snippets, and shows the encoded size. It is free, needs no sign-up, and everything runs in your browser, so your image stays private.

What is Base64 encoding?

Base64 is a way of representing binary data — like the bytes of an image — using only 64 plain text characters (A–Z, a–z, 0–9, plus a couple of symbols). Because the result is ordinary text, it can travel anywhere text can go: inside an HTML file, a stylesheet, a JSON payload or an email. A data URI wraps that text with a small header (for example data:image/png;base64,) that tells the browser what kind of file it is, so it can decode and display the image without ever downloading a separate file.

When to inline an image

Embedding an image as Base64 shines for small assets: icons, a logo, a tiny background texture, or graphics in an HTML email where external images are often blocked. It bundles everything into a single file and removes an extra network request, which can shave a few milliseconds off the first paint. It's also perfect for quick demos, prototypes and self-contained snippets you want to share without shipping image files alongside them.

When not to inline

For large or frequently reused images, a normal file URL is almost always better. Base64 adds about 33% to the size, and an inlined image can't be cached on its own — the browser has to re-download the whole string every time the HTML or CSS changes, and it can't be reused across pages. A giant data URI also makes your markup hard to read. As a rough rule, inline images under a few kilobytes and link to anything bigger.

Using the snippets

Once you've encoded an image, copy the data URI on its own to drop into JavaScript or a framework, or grab the ready-made HTML <img> tag to paste straight into a page. The CSS backgroundsnippet is ideal for decorative images — paste it into a rule to set a background without a separate file. Everything is generated locally, so you can encode sensitive or unpublished images with confidence.

Frequently asked questions

Is my image uploaded to a server?+

No. This encoder reads your image directly on your device using the browser's FileReader API. The image is never uploaded, stored or seen by anyone — the Base64 string is generated entirely in your browser.

What is a Base64 data URI?+

It's a way of writing an image as plain text. The data URI starts with data:image/… followed by a long Base64-encoded string of the file's bytes. Because it's just text, you can paste it straight into HTML or CSS and the browser rebuilds the image — no separate file needed.

When should I embed an image as Base64?+

It's handy for small assets like icons, logos or background patterns, for single-file HTML emails or documents, and to avoid an extra network request. For large images it's usually a poor trade-off, because embedding bloats your file and the browser can't cache the image separately.

Why is the Base64 version bigger than my file?+

Base64 represents binary data using only text characters, which adds roughly 33% overhead. So a 90 KB image becomes about 120 KB of text. That's normal — the tool shows you the exact encoded size so you can decide whether inlining is worth it.

How do I turn a data URI back into an image?+

Paste the full data:image URI into your browser's address bar and press Enter to view it, then right-click and choose Save image to write it back to a file. Any Base64 decoder will also convert it back to the original bytes.

More free tools