Image to Base64 Converter
Convert images to Base64 or decode Base64 strings back to images — free, instant, no upload. Generate data URIs ready for HTML img src and CSS background-image.
Image → Base64
Add the image to convert to Base64
Max 10MB
- Filename
- —
- Format
- —
- Resolution
- —
- File size
- —
- Base64 length
- —
Base64 → Image
- Format
- —
- Resolution
- —
- Est. file size
- —
Found this tool useful? Share it with someone who needs it
Related Tools
Frequently Asked Questions
What is Base64?
Base64 is an encoding method that converts binary data like images or files into a text string. It is used to embed images directly inside HTML or CSS code so that no separate image file is needed.
How do I insert a Base64-converted image into HTML?
Paste the converted Base64 string directly into the src attribute of an img tag. The format is: data:image/png;base64,CONVERTED_STRING. The same approach works for the background-image property in CSS.
Why does the file size get larger after Base64 conversion?
Base64 encoding converts every 3 bytes of binary data into 4 ASCII characters, increasing the file size by about 33% compared to the original. It''s a trade-off: fewer external requests, but larger file size.
What image formats can I convert to Base64?
JPG, PNG, WebP, GIF, BMP and SVG are supported, up to 10MB per file. The result is provided in data URI format, ready to use directly in HTML, CSS, and JavaScript.
Can I convert a Base64 string back into an image file?
Yes, simply paste the Base64 string to restore the original image and download it. Data URIs in the data:image/... format are also supported.
Features
- Two-Way Conversion: Encode images to Base64 and decode Base64 strings back to images — all in one screen
- Multiple Formats: Supports JPG, PNG, WebP, GIF, BMP, and SVG
- Instant data URI: Outputs a ready-to-use data URI for HTML img src or CSS background-image
How to Use
- Upload Image: Drag an image into the left panel or click to choose a file
- Copy Result: Copy the full data URI or just the Base64 part
- Base64 → Image: Paste a Base64 string in the right panel to restore the image
Use Cases
- HTML Embed: Use data URI in img src to display images without a server request
- CSS Background: Embed images directly in CSS via background-image: url(data:...)
- API Payload: Include image data in REST APIs or JSON payloads as Base64
- Debugging: Quickly visualize Base64-encoded image data
Code Examples
Paste the generated data URI directly into your HTML or CSS.
HTML
<!-- Inline a data URI in img src -->
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...==" alt="image">
<!-- Use with the picture element -->
<picture>
<source srcset="data:image/webp;base64,UklGRiAA...==" type="image/webp">
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...==" alt="image">
</picture>CSS
/* data URI as background-image */
.thumbnail {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...==");
background-size: cover;
background-position: center;
}
/* Use in the content property */
.icon::before {
content: url("data:image/svg+xml;base64,PHN2ZyB4bWxu...==");
}Help us improve this tool
I read every single message myself. Tell me what's not working or what you'd like to see.
More iTool Features!
HEIC Viewer
Free online HEIC viewer — open and convert Apple HEIC/HEIF photos on any device. No install, no signup required.
Photo Date Stamp (Film Camera Date)
Add a film-camera style date and time to your photos. Auto-reads the EXIF capture date, classic 7-segment orange font, adjustable position and size. 100% in-browser, no upload, no install.
Merge Photos into One
Free tool to combine multiple photos into one image. Add a number and caption to each photo for second-hand listings or document sets. Vertical or grid layout, adjustable spacing, margins, and borders, 100% in-browser with no upload or install.
Image to JPG
Free online image to JPG converter — convert PNG, WebP, BMP, HEIC to JPG. Batch convert up to 50 files at once.
Image to PNG
Free online image to PNG converter — convert JPG, WebP, BMP, and more to PNG. No install, no upload to server.
Image to WebP
Free online image to WebP converter — shrink image file size with modern WebP format. No install, no upload to server.
SVG Crop
Free online SVG cropper — auto-trim extra whitespace and margins from SVG files. No install, no upload to server.