Image to Base64

Image to Base64 — a free online tool.

Encoding an image as a Base64 string

Choose an image and this tool converts it into a Base64-encoded data URL you can paste directly into CSS (background-image: url(...)), HTML (<img src="...">), or JSON payloads - useful for embedding small images without a separate file request. Everything happens locally in your browser; your image is never uploaded.

When embedding beats a separate file request

Every linked image file normally means a separate HTTP request before it can display - for very small icons or images, especially ones that appear repeatedly across a page (like a sprite or inline logo), embedding the image directly into the HTML or CSS as Base64 can eliminate that extra round trip entirely, which matters more on pages with many small images than on pages with just one or two.

Why the encoded text is roughly a third larger

Base64 represents arbitrary binary data using only 64 safe, printable characters, and that encoding scheme inherently expands the data by about 33% compared to the original binary file size - a real tradeoff against the saved HTTP request, which is why Base64 embedding makes sense for small images but becomes a net loss for larger ones.

Where embedded images commonly get used

Email templates (where external images are often blocked or stripped by email clients), small UI icons bundled directly into a CSS file, and self-contained single-file HTML documents that need to work without any external file dependencies are the most common legitimate uses for this kind of embedding.

Veelgestelde vragen

When should I use Base64 instead of a regular image file?

It is useful for small icons or images where avoiding an extra HTTP request matters, such as inline CSS or email templates. For larger images, a regular file is usually better, since Base64 encoding increases the data size by roughly 33%.

Why is the encoded text larger than my original image file?

Base64 encoding represents binary data using only text-safe characters, which adds about 33% overhead compared to the original binary file size.

Why are email templates a common use case for this?

Many email clients block or strip externally linked images by default, but an embedded Base64 image displays immediately without depending on an external request being allowed.

Is there a size limit for images I can convert?

There's no hard limit in the tool itself, but very large images produce an extremely long Base64 string that becomes impractical to embed - for anything beyond a small icon or thumbnail, a regular linked image file is the better choice.

Can I convert the Base64 string back into an actual image file?

Yes - pasting a Base64 data URL into an <img> tag's src attribute, or into a browser address bar, renders it as an image. The Base64 to Image tool on this site also decodes a pasted string straight into a downloadable file.

Meer in Image Tools