Base64 turns the bytes of an image into plain text made of letters, digits, plus and slash. That text can sit inside HTML, CSS, JSON or an email template, so the picture travels with the code instead of as a separate file.
Output formats
| Option | Looks like | Paste it into |
|---|---|---|
| Data URI | data:image/png;base64,iVBOR⦠|
Anywhere a URL is accepted |
| Plain Base64 | iVBORw0KGgo⦠|
APIs and JSON fields that ask for raw Base64 |
| HTML img tag | <img src="data:β¦" alt=""> |
An HTML page or email template |
| CSS background | background-image: url("data:β¦"); |
A stylesheet rule |
When Base64 images make sense
- Small icons and logos under a few kilobytes, to save an extra network request.
- HTML emails, where linked images are often blocked until the reader allows them.
- Single-file reports, offline pages and test fixtures.
- APIs that accept an image only as a text field.
When it does not
Base64 text is about 33% larger than the original file, and the browser cannot cache it separately. For photos and anything over roughly 10β20 KB, a normal image file is faster. If the encoded text is huge, shrink the image first with Compress JPG or Resize Image.
Decoding Base64 to an image
Open Decode under the tool, paste a data URI, raw Base64, an <img> tag or a CSS rule, and press the button. The tool detects JPG, PNG, WebP, GIF and SVG from the data, shows the picture and downloads it. If the text is cut off or contains other characters, it tells you instead of producing a broken file.
A worked example
A small 2 KB PNG icon becomes about 2,700 characters of Base64. That is small enough to paste straight into a CSS file without making it hard to read. A 40 KB photo becomes over 54,000 characters, which bloats HTML and email templates; for anything that size, link to the image file instead.
Using Base64 images in HTML email
Many email programs block external images until the reader allows them, so a logo linked from a website shows as a broken box. Embedding the logo as a data URI makes it appear immediately in some programs. Support is not universal, though: Gmail and some versions of Outlook strip or ignore data URIs. Test with the email clients your readers use before relying on it.
Checking what an unknown Base64 string contains
Paste the string into the Decode box. The tool looks at the first bytes to work out whether it is a JPG, PNG, GIF, WebP or SVG, shows the picture, and tells you its size. If it is not a picture, you get a clear message instead of a broken download.
Frequently asked questions
Is Base64 a form of encryption?
No. Anyone can decode it. Do not use it to hide sensitive images.
Why is the Base64 bigger than my file?
Every 3 bytes become 4 characters, so the text is about a third larger.
Can I convert SVG?
Yes. SVG is encoded as data:image/svg+xml;base64,β¦.
Is my image uploaded?
No. The browser’s FileReader does the encoding on your device.