How to convert an image to Base64
- Drop an image into the box, choose a file, or paste a screenshot.
- Pick the output: a full data URI, bare Base64, a CSS background rule or an HTML image tag.
- Click Copy and paste it into your code.
Using the result
In HTML, paste the data URI into an image tag: <img src="data:image/png;base64,iVBOR..." alt="Logo">. In CSS, use it as a background: background-image: url("data:image/png;base64,iVBOR..."). Emails, single-file HTML reports and JSON payloads are other common places for inline images.
SVG is a special case
SVG files are text already, so they also work in a data URI without Base64, which is often smaller. Base64 is still the safer choice when the SVG contains quotes or symbols that would need escaping.