Image to Base64 Converter — Data URI Encoder
Drop an image here or click to choose
PNG · JPG · GIF · SVG · WebP · encoded locally
Drop an image and get its Base64 data URI, ready to paste into HTML, CSS, or an email template. The converter also gives you a copy-paste <img> tag, a CSS background rule, and Markdown. Everything runs in your browser using the FileReader API, so your image is never uploaded to a server.
Data URI size and caching trade-offs
Data URIs date from 1998, when RFC 2397 defined them. Base64 writes binary with 64 text characters: upper and lower case letters, digits, plus + and /. With 4 characters per 3 bytes, a 6 KB icon grows to about 8 KB.
An inlined image belongs to the document, so the browser cannot cache it separately and fetches it again with every page that embeds it. The browser also has to parse the whole string before the document is complete, whereas a linked file loads in parallel. Saving a request used to justify inlining, but HTTP/2 multiplexing makes many small requests cheap. A practical threshold: under a couple of kilobytes and used once, inline it; otherwise link a file.
Favicons are an exception despite their size. Google and Yandex fetch the icon from a stable URL, so a data URI favicon leaves search results without one. Outlook renders mail with the Word engine, which explains its block on data URIs in CSS backgrounds.
Frequently asked questions
- Is there a file size limit for Image to Base64?
- Yes, 10 MB. A larger image is refused with a message, because its data URI would be a third bigger again, about 13.3 MB of text in one string that the page and most editors handle badly.