ConvertWarp

Image to Base64

Encode an image as a data URI or Base64 text.

Runs in your browser. Your file is never uploaded.How we keep your files private

About this tool

Base64 turns binary data into plain text, so an image can travel inside HTML, CSS, JSON, email templates, or a config file without a separate file. A data URI wraps that text with the image type, for example data:image/png;base64,…, so a browser can show it straight from the string.

This encoder gives you the result four ways: a full data URI, raw Base64, a ready HTML img tag with width and height, and a CSS background-image line. Pick the one your code needs and copy it in one click.

The file is read in this tab. Its type is detected from the first bytes rather than trusted from the file name, so the data URI always carries the right MIME type. The bytes are encoded in chunks, which keeps big images from stalling the page. Nothing is uploaded; the text exists only in this tab until you copy or download it.

How to convert an image to Base64

  1. Choose a PNG, JPG, WebP, GIF, SVG, AVIF, BMP, or ICO image.
  2. Check the detected type, pixel size, and how much larger the text is than the file.
  3. Choose Data URI, Base64 only, HTML <img>, or CSS background.
  4. Click Copy, or download the text as a .txt file.

Files up to 50 MB are accepted. Output over 400,000 characters is shown cut short in the box to keep the page responsive, but Copy and Download always use the complete text. There is no daily limit.

Image to Base64: popular uses

PNG or JPG to Base64

Encode PNG, JPEG, WebP, GIF, SVG, AVIF, BMP or ICO images.

Image to data URI

Get a complete data:image/…;base64 string to paste straight into code.

Base64 for HTML and CSS

Choose a ready <img> tag or a CSS background-image rule, then copy or download.

FAQ

Does this upload my image?
No. Encoding happens in your browser. The image and the Base64 text stay on your device.
Why is Base64 about a third bigger than the file?
Base64 stores every 3 bytes as 4 text characters, so the text is roughly 33% larger. Servers that gzip pages win some of that back, but not all.
When is inlining an image as Base64 a good idea?
For small icons and placeholders, usually under a few kilobytes, where saving a network request matters. Large photos are better as normal files the browser can cache.
Can I use the data URI in an email?
Some email clients block data URIs, notably Gmail and Outlook desktop. Linked or attached images are more reliable in email.
Is SVG encoded as Base64 too?
Yes, as data:image/svg+xml;base64. That is the safest form to paste into CSS or JSON because it needs no escaping.

Related tools

Continue

More Images tools