Image to Base64

Encode an image to a Base64 data URI — or an <img> tag or CSS snippet — and decode a Base64 string back to a downloadable image. Everything runs in your browser, so nothing is uploaded.

Drop an image here or click to browse PNG, JPG, WEBP, GIF, BMP or SVG · stays on your device

How to Convert an Image to Base64

Two directions, both in your browser.

1

Encode

Keep the mode on Image → Base64 and drop a file. The Base64 data URI appears instantly — switch the output to an <img> tag or a CSS background-image and click Copy.

2

Decode

Switch to Base64 → Image and paste a Base64 string or full data URI. The image renders and a Download button gives you the file back.

3

Use it

Paste the data URI straight into your HTML, CSS or JSON — no separate file, no extra request. Shrink the source first with the Image Compressor or Image Resizer to keep the string small.

Base64 is best for small assets like icons and logos. To change an image's actual format instead, use the Image Converter.

Frequently Asked Questions

Does this upload my image?
No — encoding and decoding both run entirely in your browser. The image is read locally with the FileReader API and the Base64 text is produced on your own device — nothing is ever sent to a server, logged or stored. It keeps working offline once the page has loaded, and closing the tab clears everything.
What is a Base64 data URI and why would I use one?
A data URI encodes the whole image as text (a data:image/...;base64,... string) so you can embed it directly inside HTML, CSS or JSON instead of linking to a separate file. That saves an extra network request and keeps a small icon or logo self-contained — handy for emails, single-file pages, CSS backgrounds and quick prototypes.
Why is the Base64 bigger than my original file?
Base64 represents binary data using only text characters, which adds about 33% to the size. That trade-off is fine for small images (icons, logos, tiny backgrounds) where avoiding an extra request is worth it, but for large photos a normal linked file is usually smaller and faster.
Can I turn a Base64 string back into an image file?
Yes — switch to Decode, paste your Base64 string or full data URI, and the image appears with a Download button. If you paste a bare Base64 string with no data: prefix it is assumed to be PNG; include the full data:image/...;base64, prefix to keep the original format.
Which image formats are supported?
Encoding accepts PNG, JPG, WebP, GIF, BMP and SVG — any image your browser can read. Decoding works with any valid Base64 image data URI. The tool never re-encodes the pixels, so an encoded-then-decoded image is byte-for-byte the same file.

Last updated: