Image to Base64

Turn an image into a Base64 data URI, with ready-to-paste CSS and HTML, on your device.

Drag & drop
Drop an image here PNG, JPG, WEBP, GIF, SVG — or click to browse

How it works

This tool reads your image with your browser's FileReader and encodes it as a Base64 data URI — a long text string that contains the entire image inline, beginning with something like data:image/png;base64,. Because the image becomes text, you can embed it directly in HTML or CSS without a separate file. Everything happens locally in your browser, so the image is never uploaded, and you get ready-to-paste snippets for the data URI, a CSS background-image and an HTML <img> tag.

When to inline an image

Embedding a small image as a data URI saves an extra network request, which can speed up a page for tiny, frequently-used graphics like icons, logos or background textures. It's also handy when you need a self-contained file — an HTML email, a single-file page, or a template where you can't host separate assets. The trade-off is size: Base64 makes the data about a third larger than the original file and it can't be cached separately, so it's best kept for small images rather than large photos.

Typical uses

Developers use data URIs to inline icons in CSS, bundle images into a single HTML file, embed a picture in an email signature, or drop a placeholder straight into code without managing an asset path. Once converted, copy the format you need — raw data URI, CSS or HTML — and paste it wherever the image should appear.

Frequently asked questions

Why is the Base64 bigger than my image?

Base64 encoding adds roughly 33% overhead because it represents binary data using only text characters. That's normal and why inlining suits small images best.

Does it work with SVG and GIF?

Yes. Any image your browser can read — PNG, JPG, WEBP, GIF, SVG — is encoded, keeping its original format inside the data URI.

Is my image uploaded anywhere?

No. Reading and encoding happen entirely in your browser and the image never leaves your device.