Image ↔ Base64 Converter
Turn an image into a Base64 string, Data URI, HTML img tag or CSS background code, and turn pasted Base64 back into an image file. Files never leave your browser.
Convert an image to Base64 (Data URI) and back
Turn an image into a Base64 string to put in code, or restore a Base64 string you received into an image file.
Image → Base64
Add an image and four outputs are produced: the Data URI, the Base64 text only, an HTML img tag and CSS background code, each with its own Copy button. Base64 is about 33% larger than the original, so it suits small icons and logos, and a note appears above 100KB. Files over 20MB are not converted.
Base64 → Image
Paste a Data URI such as data:image/png;base64,… or just the Base64 text, and the image is restored, previewed and can be saved as a file. Line breaks and spaces are ignored, and the URL-safe - and _ characters are accepted. The first bytes decide whether it is JPG, PNG, GIF, WebP, AVIF or BMP; anything else is reported as not an image.
Things to watch
An image embedded as Base64 cannot be cached separately by the browser, and your HTML or CSS file grows by that much. Large images, or ones used many times, are better served as normal files. This tool does not shrink images, so compress the image first if you need it smaller.
Frequently asked questions
- Is my image uploaded?
- No. Conversion happens only inside this browser and nothing is sent anywhere.
- Why is Base64 larger than the original?
- It writes every 3 bytes as 4 characters, so it is always about 33% larger.