N
NJHTools

Image to Base64 / Data URI

Encode an image to a Base64 data URI, or decode a data URI back to an image. Copy it as a plain data URI, an <img> tag, or a CSS background.

100% in your browser — your images are never uploaded.

Drag an image here, or click to upload

PNG, JPEG, WebP, GIF, and SVG supported — nothing is uploaded to a server.

How to convert an image to Base64

  1. Drag an image onto the drop zone, or click it to select a file — PNG, JPEG, WebP, GIF, and SVG are all supported.
  2. Pick an output format — plain data URI, an <img> tag, or a CSS background rule.
  3. Click Copy and paste the result into your HTML, CSS, JSON, or email.
  4. To go the other way, switch to Base64 → Image, paste a data URI, preview, and download the decoded image.

Every image is read and encoded entirely in your browser with the FileReader API — no file is ever uploaded, tracked, or stored. Base64 encoding makes the string roughly 33% larger than the original file, which is the normal trade-off for inlining an image as text.

Frequently Asked Questions

Are my images uploaded to a server?↓

No. Every image is read and encoded entirely in your browser using the FileReader API. Your files never leave your device and are never uploaded, tracked, or stored.

What is a Base64 data URI?↓

A data URI embeds the image's bytes directly inside a string like data:image/png;base64,iVBORw0KGgo… so you can inline an image into HTML, CSS, JSON, or email without a separate file or HTTP request.

Which image formats are supported?↓

You can encode PNG, JPEG, WebP, GIF, and SVG images. The data URI keeps the original format and MIME type, so the decoded image is identical to the source.

Why is the Base64 string larger than the original file?↓

Base64 encodes 3 bytes of binary data into 4 ASCII characters, so the encoded text is roughly 33% larger than the source file. This is expected and is the trade-off for embedding the image as plain text.

Can I convert a Base64 string back into an image?↓

Yes. Use the Base64 to Image tab, paste a full data URI or a raw Base64 string, and the tool renders a preview and lets you download the decoded image — all locally in your browser.

Last updated: