Encode images into Base64 strings with our free Image to Base64 Converter . Upload JPEG, PNG, GIF, WebP, or SVG files and get the Base64 encoded output instantly — ready to embed in HTML, CSS, or JavaScript, or to use as a data URI. No software installation required, and the file never leaves your browser.
Base64 is a way of representing binary image data as plain ASCII text so it can travel inside text-based formats like HTML, CSS, and JSON. The trade-off is size: a Base64 string is about 33% larger than the original binary, so it suits small assets (icons, logos, sprites) more than large photos. To reverse the process and turn a Base64 string back into a file, use the Base64 to Image tool.
A tiny 1x1 pixel PNG encodes to a compact data URI you can paste straight into an HTML src attribute. Larger images produce much longer strings:
logo.png (1x1 pixel, ~100 bytes)data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+M8AAAMBAQDJ/pLvAAAAAElFTkSuQmCCBase64 encodes binary bytes into a string drawn from 64 printable characters (A–Z, a–z, 0–9, +, /), so binary image data can be carried inside text-based formats that cannot normally contain raw bytes. A data URI wraps that string with a MIME-type prefix — for example data:image/png;base64,... — so a browser knows how to render it. You can then drop the whole data URI into an <img src="..."> attribute or a CSS background-image: url(data:...) rule with no separate file request.
Each image format has its own MIME type — image/jpeg, image/png, image/gif, image/webp, and image/svg+xml — and the prefix must match the actual bytes or the browser will refuse to render it. The main benefit of inlining is fewer HTTP requests: a small icon embedded as a data URI loads in the same response as the page, avoiding an extra round-trip. The cost is that Base64 inflates size by roughly a third, and large data URIs bloat HTML and CSS and can slow parsing, so the technique shines for small, frequently-used assets rather than big images.
Over HTTP/2 and HTTP/3, multiplexing reduces the per-request overhead that Base64 inlining was designed to solve, so inlining large images is often counter-productive on modern servers. Use it for icons, favicons, and small decorative graphics. To inspect what an existing image actually contains, try the Image Data Extractor, or convert vector art with SVG to PNG.
data:image/png;base64,, not image/jpeg. data: prefix: Without the scheme and base64 marker, browsers treat the string as a relative URL. Include the full data URI when pasting into src.