Lightbench

Nothing is uploaded

Image to Base64

Turn an image into text you can paste straight into HTML, CSS or JSON.

How to use Image to Base64

  1. Drop an image onto the page.
  2. Wait a moment while it is encoded in your browser.
  3. Copy the Base64 text or the full data URI.
  4. Paste it into your HTML, CSS or JSON.

Why use this tool

Base64 turns the bytes of a picture into plain text. That text can sit directly inside an HTML page, a stylesheet or a JSON message, so no separate image file is needed. It is handy for tiny icons, email templates, single-file demos and APIs that only accept text.

Tips for best results

  • Use it for small images only. Base64 makes the data about a third bigger.
  • A full data URI starts with data:image/png;base64, followed by the encoded text.
  • Compress or resize the picture before encoding to keep the text short.

Frequently asked questions

Is Base64 a kind of encryption?

No. It is just a way of writing data as text and anyone can decode it, so never use it to hide anything.

Should I embed large photos this way?

Usually not. Large Base64 strings slow the page down and cannot be cached separately like normal image files.

Is my image sent to a server?

No. The encoding happens locally in your browser.

Related guides