Image to Base64 Converter
Convert an image to Base64 online for free: drag in a PNG, JPG, GIF, WebP, SVG, BMP or ICO and get the Base64 string, data URI, HTML img tag, CSS background and Markdown snippet instantly, or paste Base64 back to preview and download the image. 100% in your browser, no upload.
Drop an image here, click to choose a file, or paste one (Ctrl+V)
PNG, JPG, GIF, WebP, SVG, BMP, ICO. Your image never leaves your browser.
Tip: copy any image and press Ctrl+V here to paste it.
⚡ Base64 makes an image about 33% larger than the original file, so it is best for small images such as icons and logos. Use the re-encode option to convert to JPEG or WebP and lower the quality before encoding, and the stats line shows exactly how much you saved.
🔒 Privacy: encoding, re-encoding and decoding run locally in your browser. Your image is never uploaded, stored or seen by anyone else.
More developer tools
How this calculator works
An image to Base64 converter turns a picture file into a long text string you can paste directly into code. Base64 encoding represents the raw bytes of the image with 64 safe text characters, and wrapping that string in a data URI (data:image/png;base64,...) lets a browser render the image without a separate file or network request. That is why Base64 images show up in HTML emails, single-file pages, CSS backgrounds, API payloads and config files: one self-contained string replaces a file that would otherwise need hosting, a URL and a second download. Drop an image here, or paste one from your clipboard, and the converter produces the Base64 string and every ready-to-paste snippet in your browser, with a live preview so you can check the result before you copy it.
The converter gives you five outputs for the same image, so you can grab exactly the form your code needs. The raw Base64 string is the encoded bytes on their own, the data URI is the full embeddable value, and the HTML, CSS and Markdown tabs wrap it into an <img> tag, a background-image rule or a Markdown image, ready to paste. A stats line shows the original file size, the Base64 size and the overhead, which is always around 33% because three bytes of image become four characters of text. The re-encode option is what makes this converter different from a plain encoder: for raster images you can convert to JPEG or WebP and lower the quality, or cap the width, and the tool re-encodes the image in your browser before encoding it, so a 2 MB photo can become a 150 KB data URI that is actually practical to embed.
The decoder works the other way: paste a Base64 string or a full data URI and the tool validates it, sniffs the real image format from the file bytes, shows a live preview with the file size and MIME type, and lets you download the decoded image with the right extension. Your images never leave your device, encoding, re-encoding and decoding all run locally, so screenshots, logos and private photos stay private. One honest warning: Base64 is best for small images such as icons, logos and tiny illustrations. A large photo grows by a third and bloats every page that embeds it, so for photos and hero images, host the file and link to it, and reach for the Image Compressor on this site first if the file is bigger than it needs to be.
