Convert any image to a Base64 encoded string for embedding directly in HTML, CSS, or code. Also converts Base64 strings back to downloadable images. Free, instant, browser-based.
✏️ Image → Base64
💻
Drop image here or click to browse
Any image format — converts to Base64 string instantly
Base64 Output
🔄 Base64 → Image
✨ Converted!
🔒 All conversion runs in your browser — nothing is uploaded
⚙️ How It Works
1
Upload your image
Drop any image — JPG, PNG, WebP, SVG. The file is read using FileReader.readAsDataURL() entirely in your browser.
2
Choose output format
Data URI (for img src), Raw Base64 (just the encoded string), CSS background-image, or ready-to-paste HTML img tag.
3
Copy and use
Click Copy to Clipboard and paste directly into your code. The reverse decoder also works — paste any Base64 string to preview and download as an image file.
❓ Frequently Asked Questions
What is Base64 image encoding used for?
▼
Base64 encoding converts binary image data into ASCII text, allowing images to be embedded directly in HTML, CSS, JavaScript, JSON, or XML files without needing a separate image file. Common uses: email HTML templates, CSS background images, favicon embedding, offline web apps, and API payloads.
How do I embed an image in HTML using Base64?
▼
Convert your image to Base64 using this tool, select 'HTML img tag' output mode, copy the result, and paste it directly into your HTML. The resulting tag looks like: . No separate image file needed.
What is the difference between a Data URI and raw Base64?
▼
A Data URI includes the MIME type prefix: data:image/jpeg;base64,[string]. Raw Base64 is just the encoded string without the prefix. Use Data URI for HTML src attributes and CSS. Use raw Base64 when an API or service expects just the encoded data.
Does Base64 encoding make images larger?
▼
Yes — Base64 encoding increases file size by approximately 33% compared to the original binary image. This is a trade-off accepted for the convenience of embedding images directly in code. For performance-critical web pages, use file references instead of Base64 for large images.
How do I convert Base64 back to an image?
▼
Scroll to the 'Base64 → Image' section of this tool, paste your Base64 string or full Data URI, and click Preview & Download. The image renders immediately and downloads as a PNG file.