Images & colour
Image to Base64 Converter: Create a Data URI
Use Image to Base64 when you need a quick way to work through this task. Convert an image to a Base64 data URI for inline use. This guide walks through a small example and the checks to make before you use the result.
Base64 rewrites a picture’s bytes as plain text. Wrapped in a data URI, that text can sit directly inside an img tag or a CSS url(), which removes a separate file request for very small icons.
How to use the tool
- Use “Choose an image” to open a JPEG, PNG, WebP, GIF or SVG file up to 5 MB.
- Check the preview, then press “Copy result” to take the whole data URI.
- Paste it into an img src attribute or a CSS url("…") and load the page.
Try a small example
Example input or settings
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><circle cx="8" cy="8" r="8" fill="#0a7"/></svg>
What to check
The text should start with “data:image/” and the picture should look identical, because nothing is resized or compressed. Inline images cannot be cached separately and make source code long, so keep them for tiny assets. Metadata stored inside the file travels along with it. Conversion happens in your browser.
How much bigger is an image after Base64 encoding?
Roughly one third. A 110-byte SVG circle becomes a 174-character data URI: 26 characters for the “data:image/svg+xml;base64,” prefix and 148 for the encoded content. A photo of several hundred kilobytes grows by the same proportion and bloats the page that carries it.
When this is useful
For a real task, replace the sample with your own input and check the output in its final context. Keep a copy of the original if the change is hard to reverse.
Before you rely on the result
Preview at the size and on the background where the result will appear. Check file format, legibility and accessibility.