How to use Image to Base64
- Click "Choose file" or drag an image onto the box (up to 10 MB).
- The result appears straight away, with the original and encoded sizes and a preview.
- Pick a tab: Data URI, Base64 only, HTML <img> or CSS.
- Click "Copy", or download the text as a .txt file.
Features
- Four outputs: data URI, raw Base64, an HTML <img> tag and a CSS background-image rule
- Supports JPG, PNG, WebP, GIF, BMP and AVIF
- Shows the size before and after encoding and a preview of the image
- Warns when the image is over 1 MB
- Runs in your browser: no upload, no watermark, no sign-up
Supported formats and limits
- Maximum file size: 10 MB
- Up to 1 files at once
Examples
| Input | Result |
|---|---|
| icon.png, 2,048 bytes | a data URI starting with data:image/png;base64, followed by 2,732 characters of Base64 |
| logo.webp, 12,288 bytes | a data:image/webp;base64,… string of 16,384 characters, plus the matching <img> and CSS snippets |
Limitations
- Base64 makes data about 33% larger, and a Base64 image embedded in a page cannot be cached separately. It suits small icons, not photographs.
- SVG files are not accepted by this tool; SVG is text and can often be embedded directly.
- Files up to 10 MB are accepted, but anything over 1 MB triggers a warning and produces very long text.
- The image is encoded as it is; it is not resized or compressed first. Use Compress Image or Resize Image beforehand for big files.
Learn more
Base64 is a way of writing binary data, such as an image, using only plain text characters. That makes it possible to place a picture inside a text file, for example an HTML page, a CSS file, a JSON document or an email template, without linking to a separate image file.
The usual format is the data URI: data:image/png;base64, followed by the encoded bytes. Put it in an img src or a CSS url() and the browser draws the image straight from the text.
There is a cost. Encoded data is about a third larger than the file, it cannot be cached on its own, and large strings slow down pages and make files hard to read. Use Base64 for tiny assets, and compress or resize the image first. For bigger pictures, a normal image file with good caching is the better choice.
Frequently asked questions
What is a data URI?
It is a web address that contains the file itself, in the form data:image/png;base64,… Browsers display it like a normal image without fetching a separate file.
When should I embed an image as Base64?
For very small images, such as tiny icons in CSS or an email template, where saving a request matters. For larger images a normal file is usually better.
Why is the Base64 text longer than the file?
Base64 represents every 3 bytes as 4 characters, so the text is about one third bigger than the original.
Is my image uploaded?
No. The encoding happens in your browser and nothing is sent to a server.
Last reviewed: September 30, 2026