Image to Base64 Converter: Data URI
This image to Base64 converter turns a PNG, JPG, GIF, WebP or SVG into a Base64 string and a ready-to-paste data URI for HTML and CSS. It can also decode Base64 back into an image. The file never leaves your device, which makes it safe for private images and quick web development work.
Image to Base64
Encode images and decode Base64.
How to use the Image to Base64
- Choose or drop an image.
- Pick the output format: data URI, plain Base64, an img tag or a CSS rule.
- Copy the result.
- To decode, paste Base64 into the lower box and press Decode.
How it works
The file is read with the FileReader API and encoded as Base64, which represents every 3 bytes as 4 text characters. A data URI adds the MIME type in front, like data:image/png;base64, so browsers can show it without a separate request.
Example
A 3 KB icon becomes about 4 KB of text starting with data:image/png;base64,iVBORw0KGgo...
Frequently asked questions
Why is Base64 bigger than the file?
Base64 adds about 33% because it uses 4 characters for every 3 bytes.
When should I embed images as Base64?
For very small icons, to save a request. Large images are better as files.
Is my image uploaded?
No. It is converted in your browser.
See also: Base64 Encoder, Image Converter.
Convert an image to Base64
How to use it
- Choose an image file from your device.
- Pick the output: plain Base64, data URI, HTML img tag or CSS.
- Copy the result into your code.
- To go the other way, paste Base64 and view the image.
More questions
Why use a Base64 image?
It lets you embed small images, like icons, right inside HTML, CSS or JSON without a separate file.
Does Base64 make images bigger?
Yes, by about a third, so it is best for small images.
Is my image uploaded?
No. The conversion runs in your browser.
Related tools: Base64 Encode & Decode, Compress Image, SVG to PNG Converter.