Image to Base64

Convert an image to a data URL for inline embedding in CSS or HTML — with an honest size comparison so you know when it's worth it.

Drop an image, or click to choose

JPG, PNG, WebP, SVG. The data URL appears below with a size verdict.

Rule of thumb: inline Base64 only for images under ~5 KB (icons, tiny patterns). Larger images cost more in HTML weight than an extra request saves.

How it works

The file's bytes are encoded as Base64 and wrapped in a data: URL with the correct MIME type — the exact string you'd paste into a CSS background or an img src. The size comparison is measured, not estimated: Base64 adds ~33% over the binary, and the tool tells you whether the inline version is heavier than the original file (it almost always is — the question is whether that trade is worth avoiding a request).

Frequently asked questions

When is inline Base64 worth it?

Small icons and patterns below ~5 KB, where saving an HTTP request beats the 33% size overhead. Anything bigger belongs in a real file.

Does it work for SVG?

Yes — though SVGs are already text and often inline directly without Base64.

Written and maintained by Steven Huang · Last reviewed October 29, 2026.