HomeConvert & combine
Image to Base64
Turn an image into text for code, and back.
Your files never leave your device.
Quick answer
To turn an image into Base64, drop it in and copy the data URI. To go back, choose Base64 to image, paste the text and download the picture. Nothing is uploaded.
Read the guide: How to convert an image to Base64 (and back)
Drop an image here
or paste from your clipboard
How to convert an image to Base64
- To turn a picture into text, choose Image to Base64 and drop the picture in. Any picture type works, and the original file is encoded as it is.
- Pick the format you need: a data URI, plain Base64, a CSS background or an HTML image tag.
- Press Copy, or download the text as a .txt file.
- To go the other way, choose Base64 to image, paste the text and download the picture.
Base64 writes the bytes of a file as ordinary text, so a small picture can sit inside a web page, a stylesheet or an email without a separate file. The text is about a third longer than the file.
It suits small images such as icons and logos. For a large photo the text becomes very long and a normal image file loads faster, so the tool warns you above 100 KB.
Pasted text can be a full data URI or just the Base64 characters. The tool works out what kind of picture it is from the data itself (PNG, JPG, GIF, WebP, BMP, AVIF, SVG or ICO) and tells you plainly if the text is cut off or is not a picture.
Common questions
How do I convert an image to Base64?
Choose Image to Base64, drop the picture in and copy the result. The default is a data URI, which you can paste straight into an HTML or CSS file.
What is a data URI?
A way to put a file inside a web address. It starts with data: and the file type, then ;base64, then the Base64 text, for example data:image/png;base64,iVBOR...
How do I turn Base64 back into an image?
Choose Base64 to image, paste the text (with or without the data: start) and download the picture it decodes to.
Why is the Base64 text bigger than my file?
Base64 uses four text characters for every three bytes, so the text is about 33 percent longer than the file.
Is my picture uploaded?
No. The encoding and decoding happen in your browser, so your pictures and your text stay on your device.