Image to Base64 Converter
Embed a picture in HTML, CSS or JSON without a second file. Drop an image and get its Base64 data URI as text you can copy — generated in this tab, never uploaded.
- Free, unlimited
- 100% on-device
- No sign-up
Image to Base64 Converter
Drop your images here
Or choose files from your device
JPG, PNG, WebP, AVIF, GIF, BMP, ICO or SVG in · up to 20 images · max 40 MB each
Every file is decoded and re-encoded in this tab. Nothing is uploaded.
No image added yet.
Three steps — nothing to install
Add your images
JPG, PNG, WebP, GIF, AVIF, BMP, ICO or SVG, up to 20 at a time and 40 MB each. The format is read from the file header for the data URI's MIME type.
Convert to Base64
The page opens on Image → Base64 text. Each file is encoded exactly as it is — no re-encoding, no quality change, byte for byte.
Copy or download
Use Copy on a card to put the data URI on the clipboard, or Download for a .txt file. Download all zips the batch.
What a Base64 data URI actually is
Base64 is a way of writing arbitrary bytes using only 64 printable characters. It exists because text channels — HTML attributes, CSS rules, JSON strings, HTML email — cannot carry raw binary safely. Encoding an image produces a long ASCII string that can be pasted anywhere text is allowed.
A data URI wraps that string with the file's type: data:image/png;base64,iVBORw0KGgo…. Put that in an <img src> or a CSS background-image and the browser renders the picture without fetching a separate file.
The encoding is lossless and reversible. The image is not decoded, resized or re-compressed here, so the bytes you get back from a decode are identical to the file you started with.
The cost: about a third more text
Base64 uses four characters to carry three bytes, so the encoded text is roughly 33% larger than the file. A 30 KB icon becomes about 40 KB of characters. That is the entire overhead — there is no additional compression step in either direction.
It also means you should think twice before inlining a photograph. A 300 KB photo becomes a 400 KB string inside your HTML, which cannot be cached separately, cannot be loaded lazily, and delays the first render because the markup has to arrive before the image can be parsed. Inline icons and small logos; keep photographs as files.
Where inline images are worth it
Small icons and logos in a single-file HTML page or an email signature, where the alternative is a broken image because the recipient has no access to your server. CSS for tiny repeating textures and sprites, saving a request. JSON payloads where an API expects an image field as text. Markdown previews and documentation that must stay self-contained.
Two caveats worth knowing. Many email clients strip data URIs, so an inline image is not a reliable substitute for a hosted one. And a data URI in CSS cannot be cached independently: every page that includes the stylesheet downloads those bytes again unless the stylesheet itself is cached.
Formats, size and what this page does not do
The MIME type in the data URI comes from the file's contents, not its extension, so a WebP named image.jpg still gets image/webp and renders correctly. SVG is encoded as text — if the SVG contains non-ASCII characters, the resulting data URI is UTF-8 encoded text and works when the document is UTF-8.
The 40 MB per-file limit is a browser memory limit; encoding a file that size produces a string of roughly 53 MB, which is workable on a desktop and not on a phone. There is no upload and no server in the path, so nothing is logged and the page works offline after it loads.
Frequently asked questions
Does Base64 change the image quality?
No. The file is encoded byte for byte with no decoding or re-compression, so the data is identical. The only cost is that the text is about a third longer than the file.How large is the Base64 string?
About 1.33 times the file size, plus the short data URI prefix. A 30 KB image becomes roughly 40 KB of text.How do I use the result in HTML?
Paste the whole data URI into an img tag:<img src="data:image/png;base64,…" alt="">. In CSS use it as a url() value in background-image. Quote it, because the string is long and contains no spaces but many slashes.