Image to Base64

Turn an image file into a Base64 string or data URI for CSS and HTML.

How to use Image to Base64

  1. Upload an image.
  2. Copy the Base64 or data URI.
  3. Paste into CSS, HTML, or JSON.

What this tool accepts

  • Raw Base64 and data URI
  • Copy button

Formats: Any image the browser can read

Developers still inline 1 KB icons as data URIs to skip an extra request. This encoder never uploads the file — FileReader runs locally.

Data URI vs raw

CSS background-image needs the data:image/...;base64, prefix. Some APIs want the raw payload only. Both are shown.

Frequently asked questions

Should I inline large photos?

No. Data URIs bloat HTML. Use this for tiny icons, not hero images.

Related tools

IMG4FIX processes images in your browser. Ads, if shown, may use cookies. See Cookies and the Privacy Policy.