Image to Base64
Turn an image into a data URI you can paste into CSS or HTML.
Runs on your device. The file is never uploaded.
Image to Base64 reads the bytes of a file straight through and prints a single data URI. The media type comes from the extension: .jpg, .jpeg, .png, .webp, .gif and .svg are the six it maps. Nothing is decoded or re-compressed on the way. Any other extension stops with a message naming the type it does not know.
Questions
What exactly does it output?
A complete data URI as text, in the form data:image/png;base64, followed by the encoded bytes, ready to paste into a CSS background-image or an HTML img src. There is no file to download; copy the text from the page. The media type comes from the file extension.
Which file types work?
JPG, PNG, WebP, GIF and SVG, matched on the extension: .jpg and .jpeg give image/jpeg, .png gives image/png, .webp gives image/webp, .gif gives image/gif and .svg gives image/svg+xml. Anything else stops with a message naming your file and the extension it does not know, such as "logo.bmp: unknown image type ".bmp"".
Does it re-compress or change my image?
No. The bytes of your file are encoded exactly as they are, with no decoding step at all, which is why it accepts GIF and SVG when the other image tools here do not. Any EXIF, GPS or colour profile inside the file rides along into the data URI, so strip it first with Remove image metadata if that matters.
Why is the base64 bigger than my file?
Because base64 stores three bytes in four characters, so the encoded text is about a third larger than the original, before the data: prefix. That is the trade for saving an HTTP request. Compress the image first with Compress image if the result is too long to be worth inlining.
Is my image uploaded?
No. The encoding happens in a Web Worker in this tab and the result stays on the page. Nothing is sent anywhere and there is no account. You can drop several images at once and each one produces its own data URI.