Convert
Convert an image to Base64
Drop in an image and get a Base64 string or a complete data: URI, ready to paste into HTML, CSS or a JSON payload. The media type comes from the file's actual bytes rather than its extension, so a PNG named .jpg still produces a data URI that renders. Worth knowing before you use one: Base64 is about a third larger than the file it encodes, and an embedded image cannot be cached separately from the page that carries it - so it is usually a win for a small icon and usually a loss for a photograph. The page shows you the size either way.
How to convert an image to Base64
- Drop in an image. Small ones - icons, logos, placeholders - are what this is for.
- Copy the data URI, or the CSS rule if that is where it is going.
- Check the size it reports before you commit to embedding it.
Supported formats
This tool accepts JPG, PNG, WebP, GIF, BMP and AVIF files. Everything is decoded by your own browser, so the formats available depend on what your browser can open - which for HEIC in particular varies between Safari and other browsers.
Frequently asked questions
When is a data URI actually a good idea?
For something small that is needed immediately and never changes: an icon in a stylesheet, a placeholder, a tiny logo in an email template. It removes one request. For anything larger it is usually a loss, because the bytes grow by a third, they cannot be cached independently of the file that embeds them, and every page including that CSS now carries the image whether it displays it or not.
Why is my Base64 bigger than the image?
Because Base64 represents three bytes with four characters, which is a fixed 33% overhead before you count the data: URI prefix. That is not a fault of this tool or a setting you can change - it is what the encoding is. If the size matters, compress or resize the image first and encode the smaller result.
Is there a size limit?
Yes, about 6 MB. Not as a policy but as a practical limit: a 20 MB photo becomes a 27-million-character string that the browser has to build, hold and render into a text box, and that is a locked-up tab rather than a slow one. The tool refuses with an explanation instead of freezing, and suggests compressing first.
Does it work with SVG?
Not on this page. SVG is text rather than binary, so it does not need Base64 at all - a data URI can carry it directly with URL encoding, which is both smaller and readable. This tool works on the raster formats, where Base64 is the right answer.
Is my image uploaded?
No. The file is read into memory and encoded by your browser on your device. There is nothing to send and a content security policy the browser enforces prevents this page from making a request to another domain at all, so the string you copy came from a buffer in this tab.
Related tools
Looking for something else? Browse all ImageUtility tools.