Image to Base64
Convert any image to a Base64 encoded string or Data URI for use in HTML/CSS.
Drop your image here or click to browse
JPG, PNG, WebP, GIF, BMP, SVG supported
Turn any image into a Base64 string
Base64 encoding rewrites a binary image as plain text made up of letters, numbers, and a few symbols. This lets you embed an image directly inside your code instead of linking to a separate file. Developers use it to inline small icons in CSS, to ship images inside JSON or HTML email, and to avoid an extra network request for tiny graphics.
This tool converts any image you provide into both a complete Data URI (ready to drop straight into an img tag or CSS background) and the raw Base64 string on its own. It also shows the original file size next to the encoded size so you can judge whether inlining is worthwhile.
How to encode an image
Drop an image on the upload area or click to browse for a JPG, PNG, WebP, GIF, BMP, or SVG file. The tool reads it instantly and displays a preview rendered from the encoded data, confirming that the output is valid.
You then get two text boxes: the full Data URI and the Base64 string by itself. Use the Copy button next to whichever one you need. A ready-to-use HTML example is shown so you can see exactly how the Data URI slots into an img tag.
When to use Base64 (and when not to)
Base64 is great for very small, frequently used images like icons and logos, where avoiding a separate file request improves load time. Keep in mind that Base64 encoding makes the data roughly 33 percent larger than the original file, so it is a poor choice for large photos, which are better served as normal linked image files.
Encoding happens entirely in your browser with the FileReader API, so your image is never uploaded to a server and stays private on your device. The tool is free and has no limit on the number of images you convert.