Drag and drop a PNG, JPG, GIF, WebP, SVG or ICO to get a Base64 data URI instantly.
The format is detected from the file's actual content, so SVG and ICO convert correctly
even on systems that don't report a file type for them. Runs entirely in your browser.
Data URI · Raw Base64 · HTML & CSS output · Free
PNG, JPG, GIF, WebP, BMP, SVG, ICO — up to 10 MB
PNG, JPG, GIF, WebP, BMP, SVG or ICO — up to 10 MB.
Read from the file's own signature, not just the browser's (sometimes wrong) label.
Data URI, raw Base64, an HTML <img> tag, or a CSS url().
Copy to clipboard or download as a .txt file.
An image to Base64 converter turns the binary bytes of an image file into a Base64 ASCII string, safe to embed in HTML, CSS, JSON or XML without a separate image file or an extra HTTP request. This tool encodes entirely in your browser using the FileReader API — your image is never uploaded.
Browsers get a file's MIME type from the operating system, and on some systems — Windows in particular —
.svg and .ico aren't registered there, so file.type comes back
empty. A tool that trusts that value blindly either rejects the file outright, or worse,
produces a data URI with no format in it at all (data:;base64,...), which renders as a
broken image everywhere it's used. This tool checks the file's own signature — and falls back to its
extension — so the correct data:image/svg+xml;base64, or data:image/x-icon;base64,
prefix is used regardless of what the browser reported.
Use the Raw Base64 tab when an API or script expects the string without the data: prefix:
For larger images, Base64 typically costs about 33% more bytes than the original binary file and cannot be cached separately by the browser — a normal image file with proper HTTP caching is usually the better choice.
data:image/png;base64,...), it can be embedded directly in HTML, CSS or JSON with no separate file and no server request..svg and .ico because those extensions aren't registered in the OS's MIME database. A tool that trusts that value alone either rejects the file or produces a broken data URI with no image format in it. This tool checks the file's actual signature and, if needed, its extension, so those formats convert correctly regardless of what the browser reported.src. The image displays inline with no external file.background-image declaration — useful for small icons and patterns where you'd rather avoid an extra request.