ImgWrench's image to Base64 converter turns any PNG, JPG, GIF, WebP, AVIF, BMP, ICO or SVG into Base64 text. You get four ready-to-use versions: a data URI, bare Base64, an HTML <img> tag and a CSS background-image rule, each with a copy button.
How to convert an image to Base64
- Drop an image into the tool above, paste one with ⌘V or Ctrl+V, or click to choose a file.
- Copy the version you need: data URI, Base64, HTML or CSS.
- Or download it as a .txt file if it's too long to paste comfortably.
Data URI, HTML and CSS
A data URI is the Base64 with its type in front, such as data:image/png;base64,. Browsers treat it like an image URL, so it works anywhere a URL does: the src of an <img>, a CSS url(), or a favicon <link>. ImgWrench reads the image type from the file's own bytes, so the prefix is right even if the file extension isn't.
When Base64 helps, and when it doesn't
- Good for small images. Icons and tiny backgrounds inlined in CSS or HTML save a separate request.
- Bad for large images. Base64 is about a third larger, and an inlined image is downloaded again with every page or stylesheet that contains it.
- SVG is often smaller as text. For simple vector icons, compare the Base64 size with the SVG file itself.
Why ImgWrench
- Four formats at once. Data URI, Base64, HTML and CSS, ready to copy.
- Works both ways. Paste Base64 in the other tab to get the image back.
- Private by design. Your images never leave your device.