Skip to content
Util.Ninja

Image to Base64 Converter

Turn an image into a Base64 string or data URI you can paste straight into HTML, CSS or JSON. Copy the plain Base64, an <img> tag or a CSS background. Need the reverse? Decode Base64 back to an image below.

Choose an image or drop it herePNG, JPG, GIF, WebP, SVG or ICO

Base64 to image

Download image

How to use

  1. Choose an image or drop it on the box.
  2. Copy the format you need: data URI, Base64 only, an HTML img tag or a CSS background.
  3. To go back, paste a Base64 string in the second box and see the picture.
  4. Press Download image to save it.

What is a data URI?

A data URI puts the file inside the text of a page, in the form data:image/png;base64,.... The browser shows the image without another request. It is handy for small icons, email templates and single-file pages. The Base64 text is about 33% larger than the original file.

When to avoid it

Do not inline large photos: the page gets heavy and the image cannot be cached on its own. Compress the image first with the image compressor. For JSON data, try the JSON formatter.

Frequently asked questions

How do I convert an image to Base64?

Choose the image above. The Base64 string and the data URI appear straight away, ready to copy.

Is the image uploaded?

No. It is encoded in your browser.

Why is the Base64 bigger than my file?

Base64 turns every 3 bytes into 4 characters, so the text is about one third larger.

Can I decode Base64 back to an image?

Yes. Use the second box on this page and paste the string, with or without the data: prefix. Without a prefix it is treated as PNG.

More free tools

PNG to JPG converterConvert PNG images to JPGFavicon generatorMake favicon.ico and app iconsJSON formatter & validatorBeautify, validate, tree viewQR code generatorLinks, Wi-Fi, contacts, PNG & SVGWord & character counterWords, characters, reading timeImage compressor & resizerShrink and resize JPG, PNG, WebPPassword generatorStrong passwords & passphrasesEpoch converterUnix timestamps to dates and back