All tools

Image to Base64 Converter

Image

Convert an image to a Base64 data URI with HTML, CSS and Markdown snippets, or decode Base64 back to a downloadable image

Loading tool…
Was this tool helpful?
imagebase64data-uriencodedecodepngsvgcss

About Image to Base64 Converter

Drop, browse or paste an image and get it back as a data URI, a bare Base64 string, an <img> tag with its width and height filled in, a CSS background-image rule, or Markdown, ready to paste into an email template, a stylesheet or a test fixture. The other direction takes a data URI, raw Base64 (URL-safe, unpadded or wrapped across lines) or a whole CSS url(...) value, shows the image, and lets you download it with the right extension. The format always comes from the file's magic bytes rather than its name or declared type, so a PNG labelled image/jpeg gets flagged. You also see how much bigger the encoded version is and a warning once an image is too large to be worth inlining. Everything runs in your browser and nothing is uploaded.

How to use Image to Base64 Converter

  • 1.Drop an image on the Image to Base64 tab (or press Ctrl/Cmd+V to paste a screenshot), pick Data URI, Base64 only, HTML, CSS or Markdown, then copy it or download it as a .txt file.
  • 2.Switch to Base64 to Image and paste a data URI, a raw Base64 string or a CSS url("data:...") value to preview it, check its real type and pixel size, and download it as a file.
  • 3.Read the size line before you inline anything: Base64 adds about 33%, and the tool warns once an image passes about 10 KB, where serving a normal file is usually faster.

Frequently asked questions

Should I inline images as Base64 data URIs?
Only small ones, such as icons, tiny placeholders or images in HTML email. A data URI is about a third larger than the file, can't be cached separately, and is downloaded again with every page or stylesheet that contains it, so anything past roughly 10 KB is usually better as a regular file.
Is my image uploaded anywhere?
No. Encoding, decoding and the preview all happen in your browser. The REST API and SDKs run the same code if you need it in a build script, and the API only receives a file when you call it yourself.
Why does it say the data URI type doesn't match the bytes?
The tool checks the file's signature (for example 89 50 4E 47 for PNG) instead of trusting the label. A mismatch usually means a file was renamed or a server set the wrong Content-Type. Browsers often render it anyway, but SVG and strict viewers may not.
Which formats are supported, and why are dimensions sometimes n/a?
PNG, JPEG, GIF, WebP, BMP, ICO, SVG, AVIF, HEIC and TIFF are recognized. Width and height are read from the file header for PNG, JPEG, GIF, WebP, BMP and ICO, and from the width, height or viewBox of an SVG. AVIF, HEIC and TIFF are encoded fine but their size isn't read, and the tool doesn't resize or recompress images (use Image Compressor for that).

Use via API, SDK, or MCP

cURL# Free: 1,000 req/day · Pro: 10,000 req/day
curl -X POST https://api.utilix.tech/v1/tools/image-to-base64 \
  -H "Authorization: Bearer utx_live_..." \
  -F "file=@logo.png"

Get an API key from your dashboard · Full API docs →