Image to Base64 Converter
Convert images to Base64 data URIs. Free, no signup, runs in your browser.
How It Works
Select any image file and click Convert. The image is read as a Base64-encoded data URI string that you can embed directly in HTML, CSS, or JSON. Use the Copy button to copy it to your clipboard.
Everything runs in your browser. No file is ever uploaded to a server.
What Is a Base64 Data URI?
A data URI embeds file data directly in a string, typically starting with data:image/png;base64,... This allows images to be included inline in HTML or CSS without a separate HTTP request, which is useful for small icons, email templates, and single-file applications.
Data URI Prefixes by Format
The prefix is set automatically from the file type you select. These are the common ones you will see at the start of the output:
| Image type | Data URI prefix |
|---|---|
| PNG | data:image/png;base64, |
| JPG / JPEG | data:image/jpeg;base64, |
| GIF | data:image/gif;base64, |
| WebP | data:image/webp;base64, |
| SVG | data:image/svg+xml;base64, |
Common Uses
Inline Base64 images are handy for embedding small icons and logos directly in an HTML or CSS file, bundling graphics into email templates so they display without external hosting, adding images to a JSON payload or a single-file app, and avoiding an extra HTTP request for tiny assets. Because encoding adds roughly a third to the file size, reserve it for small images and keep large photos as normal linked files.
Frequently Asked Questions
How do I convert an image to Base64?
Click Select an image, choose any image file, then click Convert. The tool reads the file and produces a complete Base64 data URI. Use Copy result to copy the string to your clipboard for pasting into HTML, CSS, or JSON.
What does the output look like?
It is a full data URI, not just the raw Base64 payload. It begins with a prefix like data:image/png;base64, followed by the encoded image data, so you can paste it straight into a src or background-image without any extra wrapping.
Which image formats can I encode?
Any image your browser can open, including PNG, JPG/JPEG, GIF, WebP, and SVG. The MIME type in the data URI prefix is set automatically from the file you choose, so the output already declares the correct format.
Are my images uploaded to a server?
No. The conversion uses the browser's FileReader to read the file locally, so your image never leaves your device and nothing is sent to any server. It also works offline once the page has loaded.
Is there a file size limit?
There is no fixed limit set by the tool, but Base64 encoding adds about 33% to the file size and very large images produce very long strings. Base64 data URIs are best suited to small images like icons, logos, and email graphics.