How to use it
An image to Base64 converter turns a picture file into plain text you can write directly into HTML, CSS or JSON, so the image travels inside the page or the data instead of as a separate download. This tool reads JPG, PNG, WebP, GIF, SVG and other images in your browser and gives you a data URI, raw Base64, a CSS rule or an HTML tag.
How to convert an image to Base64
- Add the image with the file picker or drag it onto the page; the limit is 10 MB.
- Pick the output format: data URI, Base64 only, CSS or HTML.
- Check the preview, the original file size and the length of the Base64 text.
- Copy the result to the clipboard, or download it as a .txt file when it is long.
- Paste the code into your HTML template, stylesheet or JSON request body.
The four output formats and where each fits
| Format | Starts like | Typical use |
|---|---|---|
| Data URI | data:image/png;base64,iVBORw0KGgo… | Anywhere a URL is expected: src, url(), a JavaScript variable |
| Base64 only | iVBORw0KGgo… | APIs that take the image as a Base64 field, database records, config files |
| CSS | background-image: url("data:image/svg+xml;base64,…") | Small icons and patterns used as backgrounds without an extra request |
| HTML | <img src="data:image/jpeg;base64,…" alt=""> | Single-file HTML reports, offline demos, document templates |
The alt attribute in the HTML output is left empty; if the image carries meaning, write a description yourself. For JSON payloads, check the API documentation: some services want raw Base64 and reject the data: prefix as invalid, others expect the full data URI.
Why the Base64 text is bigger than the file
Base64 writes every 3 bytes as 4 characters, so the text is roughly a third longer than the original file. A 6 KB icon becomes about 8 KB of text, and a 300 KB photo turns into well over 400 KB. The tool encodes the file's bytes exactly as they are, with no recompression or resizing. For a shorter result, shrink the image first with the image compressor or the image resizer, then bring it here.
The MIME type is detected from the signature in the file's first bytes, not from its name. A PNG that was accidentally renamed to .jpg still gets the correct image/png label in the data URI. If the signature is not recognized, the file type reported by the browser is used.
Should you inline the image or keep a separate file?
An inlined image saves one HTTP request, but it is not free. The browser cannot cache it on its own, so it is downloaded again every time the HTML or CSS file containing it is fetched. As a rough rule, images under 10 KB are good candidates for inlining.
- Good to inline: small icons, loading spinners, tiny logos on a one-page landing site, single-file HTML reports that are emailed or opened offline, and test fixtures.
- Do not inline: large photos, logos and backgrounds repeated on every page of a site, the hero image that is the largest element on the page, responsive images served in several sizes, and images that change often.
A note on SVG icons: SVG is already text, so Base64 only makes it longer. An SVG embedded in CSS with URL encoding usually comes out shorter. Base64 is more practical when every character must be safe, for example when the SVG travels inside a JSON field.
Base64 images in email signatures
Base64 is often suggested for putting a logo in an email signature, but email clients behave inconsistently. Some webmail services and corporate clients do not display images embedded as data URIs, block them or show them as attachments. Before you start using the signature, send test messages to yourself and to a few addresses on different services. If the image does not appear, hosting the logo on a web server and linking it with a normal URL is the more reliable route.
Related tools and privacy
To see which image a Base64 string contains, the Base64 to image converter does the reverse. If you need to encode or decode text rather than images, the Base64 encoder and decoder handles UTF-8 correctly. Our article on what Base64 is explains how the encoding works.
The file you choose is read and encoded by JavaScript in your browser; the file itself is not transmitted to our server, and the page only increments an anonymous usage counter. That matters when you are working with an unreleased product shot or a client's logo.