Image to Base64

Encode an image as a Base64 data URL.

FreeNo accountOn your device

Runs in your browser. How to verify

Loading tool…

About this tool

Choose an image and press Process. You get its Base64 data URL, which you can paste into an img tag, a CSS background or a JSON field.

How to use

1
Step 1
Choose an image file.
2
Step 2
Press Process.
3
Step 3
Copy the data URL from the result.

How it works

The file is read as bytes and encoded as a data URL, starting with data: followed by the file's type and;base64,. Base64 turns every 3 bytes into 4 characters, so the text is about one third larger than the file. The original file type is kept, so a PNG stays PNG.

Base64 length ≈ file bytes × 4 ÷ 3

Worked example

A small icon

Input
A 3 KB PNG icon
Output
A data URL of roughly 4 KB
Walkthrough
3 KB × 4 ÷ 3 = 4 KB of Base64 characters, plus the short data: prefix.

Limitations

  • Output is about 33% larger than the file.
  • Large images create very long strings that are unwieldy in HTML or CSS.
  • The result includes the data: prefix; remove it if an API wants bare Base64.

Questions

How do I convert an image to Base64?
Choose the image, press Process, and copy the Base64 output.
Does the result include data:image/png;base64,?
Yes. The full data URL is returned.
Is the image uploaded?
No. It is encoded in your browser.

Features

  • Full data URL
  • Any image type
  • Private, in-browser

Related resources

Guides and videos from around the web—opens on YouTube or the publisher’s site.

  • How Image Compression Works

    Leo Isikdogan

    Compression intuition for resize and optimize image tools.

    Watch on YouTube
  • Responsive images - PWA Training

    Chrome for Developers

    How image weight affects real-device performance.

    Watch on YouTube