How to use it
- 1.To encode, keep “Image to Base64” selected and drop an image on the page, paste one from the clipboard, or click “Choose an image”.
- 2.Copy the version you need: the data URI for an
srcorurl(), plain Base64 for an API, or the ready-made HTML tag or CSS rule. SVG files also get a shorter URL-encoded data URI. - 3.To decode, switch to “Base64 to image” and paste a data URI or plain Base64. CSS or HTML that contains one works as well.
- 4.Check the preview, format and size, then click Download to save the image with the right file extension.
What a data URI is
A data URI puts a whole file inside a URL, so a page can show an image without a separate download. The syntax is data:[<media type>][;base64],<data>, for example data:image/png;base64,iVBORw0KGgo…. The media type tells the browser what the data is; ;base64 says the data is Base64-encoded rather than URL-encoded text.
Base64 writes every 3 bytes of the file as 4 plain ASCII characters, which is why the result is about a third larger than the image. Gzip and Brotli win back part of that when the page is sent, but the browser still has to decode the full text.
When inlining an image helps, and when it hurts
Inlining pays off for very small images: icons, tiny backgrounds and placeholders of a kilobyte or two, where a separate request would cost more than the bytes. It’s also handy for single-file HTML reports, test fixtures, and APIs or JSON documents that expect an image as text.
For anything larger it usually makes pages slower. The image can’t be cached on its own, so it is downloaded again with every page or stylesheet that contains it; in CSS it also delays rendering, because the browser waits for the whole stylesheet. Over HTTP/2 extra requests are cheap, so a normal image file is the better choice above a few kilobytes.
Email is a special case: Gmail and Outlook don’t display data URI images, so newsletters should link hosted images or attach them as inline (CID) attachments instead.
A shorter data URI for SVG
SVG is text, so it doesn’t need Base64 at all. A URL-encoded SVG data URI such as data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg'… is usually 15 to 25 % shorter, compresses better and stays readable in your CSS.
Only a few characters have to be escaped: <, > and above all # (written %23), which would otherwise end the URL, for example in a colour like fill='%23f00'. This tool also collapses whitespace and switches to single quotes so the URI fits inside url("…") without further escaping.
Questions and answers
Is my image uploaded anywhere?
No. The image is read and encoded by your browser on your own device, and pasted Base64 is decoded there too. Nothing is sent to nestoo or anyone else.
Why is the Base64 version bigger than the image file?
Base64 represents each 3 bytes with 4 characters from a 64-character alphabet, so the text is about 33 % larger than the file, plus the short data:image/…;base64, prefix. That’s the price of storing binary data as plain text.
How do I use a data URI in HTML, CSS, Markdown or JSON?
In HTML, put it in the src of an image: <img src="data:image/png;base64,…" alt="">. In CSS, use it in url(): background-image: url("data:…");. In JSON it’s an ordinary string; many APIs want only the Base64 part without the data: prefix. Markdown accepts  in principle, but GitHub and many other sites strip data URI images, so link a hosted image there.
How big can the image be?
The tool encodes images up to 20 MB, and browsers can display data URIs of several megabytes. In practice, keep inlined images to a few kilobytes: larger ones bloat your HTML or CSS and can’t be cached separately.
How do I turn a data URI back into an image file?
Switch to “Base64 to image” and paste the data URI or the bare Base64. The tool detects the real format from the data itself, shows a preview and saves the file with the correct extension, even if the URI claimed a different type.