Base64 ↔ Image
Drag in any image to get its Base64 data URL, or paste a Base64 string to preview and download the image.
What is Base64 Image Encoding?
Base64 image encoding converts a binary image file (JPEG, PNG, GIF, WebP, SVG, etc.) into a string of ASCII text. This encoded string can be embedded directly in HTML, CSS, or JSON without needing a separate file request — making it useful for inline images, email templates, and data URIs.
How to convert an image to Base64 online
- Upload your image or paste a Base64 string into the input area.
- The Base64 output or decoded image preview appears instantly.
- Copy the Base64 string and use it as a data: URI in your HTML or CSS.
Frequently Asked Questions
How do I use a Base64 image in HTML?
Use a data URI as the src attribute: <img src="data:image/png;base64,iVBORw0KGgo...">. The browser decodes and displays it without an additional HTTP request.
When should I use Base64 images?
Base64 images are best for small images (icons, logos under 10 KB) where the HTTP request overhead outweighs the 33% size increase from encoding. For larger images, always serve them as separate files.
What image formats are supported?
Any image format your browser supports: JPEG, PNG, GIF, WebP, SVG, BMP, ICO, and more.
Does this tool upload my image?
No. Everything runs locally in your browser using the FileReader API. Your image never leaves your device.