IMAGES / BROWSER TOOL

Image to Base64

Create a data URL for a small image.

Processed on your device · no account needed
Your inputUp to 30 MB · stays on your device
Drop a file hereor choose from your device · 30 MB total
Data URLs increase size by about a third. Keep large images as files.
Result

Your result will appear here.

Choose a file, check the settings, then process it.

How to use the image to base64

A data URL embeds an image directly in a page or stylesheet, which is handy for icons and small graphics that should not need a separate request.

Choose the image and run the tool. The data URL is shown on the page and downloads as a text file ready to paste into an img src or a CSS url().

  1. Drop an image onto the box or choose it with the file picker.
  2. Press Process file.
  3. The data URL appears in the result box. Select all of it to copy it, or download it as a .txt file named after your image.
  4. Paste it into an img src attribute or a CSS url().

Good to know

  • Static PNG, JPEG or WebP images up to 5 MB; animated images are not supported.
  • The output starts with data:image/… and is about a third larger than the original file.
  • Large images make very long strings that slow pages down; keep embedded images small.
  • The image is encoded by your own browser and never uploaded.

Examples

  • A 3,000-byte PNG icon becomes a 4,022-character data URL: 22 characters of “data:image/png;base64,” plus 4,000 characters of Base64.

If something goes wrong

“Base64 images are limited to 5 MB.”

Compress or resize the image first. Embedded images are best kept to a few kilobytes anyway.

There is no copy button.

Click into the result text, select all of it and copy, or open the downloaded .txt file.

“Choose a static PNG, JPEG or WebP image.”

SVG, GIF, HEIC and other formats are not accepted here.

Questions

Where do I use the result?

In HTML as <img src="data:…"> or in CSS as background-image: url(data:…).

Why is the text so long?

Base64 adds about 33% to the size, and every byte of the image becomes text.

Can I turn a data URL back into an image?

Paste it into a browser’s address bar to view it, then save the image from there.

How can I tell which format a data URL holds?

Look at the start: data:image/png, data:image/jpeg or data:image/webp. The Base64 part of a PNG always begins with iVBORw0KGgo and a JPEG with /9j/.

Next steps: Image compressor · Image resize · Base64 encoder and decoder

Keep going