Skip to content

Convert image to Base64

Convert an image to a Base64 string (data URL) that you can embed directly in HTML, CSS or JSON without a separate file.

Processed on your device. Nothing is sent to any server.

or click to select it

Reads the file with the browser's FileReader API and encodes it as a data URL, the standard format for embedding binary files as text.

Use cases

  • Embedding a small icon directly in CSS without an extra HTTP request.
  • Adding an image to a configuration JSON.
  • Quickly testing an image in a prototype without uploading files.

How it works

  1. 1

    Upload your image

    Drag the file in or pick one from your device.

  2. 2

    Copy the result

    The Base64 text (data:image/...;base64,...) appears ready to copy.

Technical details

  • The result is a complete data URL (data:image/…;base64,…) you can paste into an HTML src attribute or a CSS url().
  • The file is encoded as-is, without recompressing it. It takes roughly 33% more space than the original: a 30 KB image produces about 40 KB of text.
  • Limit: 25 MB, although for embedding in code it only makes sense for icons or images of a few KB.

Frequently asked questions

Is Base64 a good idea for large images?

No, Base64 increases file size by around 33% and can't be cached separately; it's best for small icons, not photographs.

← Image