Image to Base64

Convert images to Base64 data URLs.

Drop an image here or click to browse

PNG, JPG, GIF, SVG, WebP · up to 5.00 MB

About the Image to Base64

Turns an image into a Base64 data URL you can paste straight into CSS, HTML, or a JSON payload, so a small icon ships inside the file that uses it instead of costing a second request. Drop the file in and choose the output you want: the raw data URL, a background-image rule, or a complete img tag. Your browser reads the file locally and never uploads it.

How to use the Image to Base64

  1. Drop an image onto the upload area, or click it to browse. PNG, JPG, GIF, SVG, and WebP all work, up to 5 MB.
  2. Choose Data URL, CSS background, or HTML img from the Output selector.
  3. Press Copy to take the result, or Clear to start over.

Frequently asked questions

How much bigger does Base64 make the file?
About a third. Base64 writes every three bytes as four characters, so a 30 KB PNG lands near 40 KB of text. Both sizes are shown once the image is loaded, so you can judge whether the saved request is worth it.
When should I inline an image rather than link it?
For small assets: icons, tiny background patterns, an image in an HTML email. Inlined bytes cannot be cached on their own and are re-sent with every copy of the file that contains them, so anything large is better left as its own request.
What is the size limit?
5 MB. Larger files are rejected, and an image that size should not be inlined anyway.
Does SVG work?
Yes, it is encoded like any other image. For SVG in CSS, percent-encoding is usually smaller than Base64, though Base64 is easier to paste around because it contains no characters that need further escaping.
Is my image uploaded?
No. The browser's FileReader turns the file into Base64 on your machine, and this site has no upload endpoint.

Related tools