๐ฃ Image to Base64
Building a web page and want to write a small icon straight into your code instead of shipping a separate image file? Convert the image to Base64 / Data URI โ a single string you can embed in HTML or CSS. Conversion happens entirely in your browser; images are never uploaded to any server, and no sign-up is needed.
Click to select an image, or drag it here
Supports JPG / PNG / WebP / GIF / SVG โ small images under 500KB recommended
How to Use
- Click the dashed box to pick an image (icons and logos work best), or drag it in.
- The tool converts it to Base64 automatically, showing a preview, the original size, and the encoded length.
- Choose the output format: Data URI pastes straight into
<img src="/tools/...">or CSSurl(...); raw Base64 suits JSON or code variables. - Click "Copy result" and paste it into your code.
When should you use Base64?
Base64 is for small images: web icons, button backgrounds, tiny logos in email templates. The upside is one less HTTP request and the image travels with your code. The cost is ~33% size bloat plus no browser caching โ so never convert large images: a 2MB photo becomes a ~2.7MB string that will choke your page. Rule of thumb: under 10KB, go for it; over 100KB, serve the file normally.
A Data URI looks like data:image type;base64,encoded content โ for example data:image/png;base64,iVBORw0โฆ. When a browser sees data:, it knows inline data follows and renders it directly with no extra request.