Image to Base64
FreeTurn an image into a Base64 string, data URL, HTML tag or CSS rule — in your browser.
Drag & drop your image here
or
PNG JPG WebP GIF BMP ICO AVIF SVG
Up to 10MB · or paste from your clipboard
Runs entirely in your browser — your image is never uploaded.
This tool works entirely inside your browser. Your image is never uploaded to our servers or anyone else's.
About this tool
Encodes an image as Base64 text so it can be embedded directly in HTML, CSS, JSON or an email template instead of being loaded as a separate file. The conversion happens inside your browser: the image is read from your device and never sent to a server.
How it works
The file's first bytes are checked to confirm what kind of image it really is — the file name and extension are not trusted. Its bytes are then Base64-encoded and wrapped in the format you choose, using the detected type for the data URL's media type. The image's width and height are read so the HTML tag can include them, which helps avoid layout shift.
How to use it
Drop an image onto the box, choose one, or paste a screenshot. Pick the output you need — a data URL, the bare Base64 string, an HTML img tag or a CSS background-image rule — then copy it or download it as a text file.
What you can upload
PNG, JPG, WebP, GIF, BMP, ICO, AVIF or SVG, up to 10MB. Very large images produce very long strings, so this is most useful for icons, logos and small graphics.
Understanding your result
You see the detected type, dimensions, file size and the length of the encoded text. Base64 is about a third larger than the original file, and the tool shows the exact overhead for your image.