Features
- Bidirectional Base64 image conversion
- Data URL parsing and generation
- Live image preview
- MIME type detection and display
- Support for all common image formats
- Handles both raw Base64 and data URLs
Use Cases
Email Embedding
Embed images directly in HTML emails without external hosting
CSS Sprites
Inline small icons in CSS for reduced HTTP requests
Single-File HTML
Create self-contained HTML documents with embedded images
API Payloads
Include image data in JSON API requests/responses
Supported Formats
The tool works with all browser-supported image formats:- PNG - Lossless compression, transparency support
- JPEG/JPG - Lossy compression, photos
- GIF - Animation support, limited colors
- SVG - Vector graphics
- WebP - Modern format with superior compression
- BMP - Uncompressed bitmap
- ICO - Icons and favicons
Input Formats
Data URL (for decoding)
Complete data URL with MIME type:Raw Base64 (for encoding)
Base64 string without data URL prefix:When converting raw Base64 to a data URL, the tool defaults to
image/png MIME type.Output Format
From Data URL
Extracts the Base64 portion and displays metadata:To Data URL
Generates complete data URL:Examples
- Decode Data URL
- Encode to Data URL
- Inspect Image Data
Extract Base64 from a data URL.Input:Output (Base64):Meta:Preview: Red circle SVG displayed
Implementation Details
Fromlib/tools/engine.ts:406-422:
Common Patterns
Inline CSS Background
Embed small icons in CSS:HTML Image Tag
Embed images directly in HTML:JSON API Payload
Include image data in API responses:Canvas Export
Export canvas as Base64:Size Considerations
When to Use Base64 Images
Good for:- Small icons and sprites (< 10KB)
- Single-file HTML documents
- Email templates
- Reducing HTTP requests for tiny assets
- Large photos or images (> 50KB)
- Images that need caching
- Responsive images with multiple sizes
- Images used across many pages
MIME Type Reference
| Format | MIME Type | Use Case |
|---|---|---|
| PNG | image/png | Icons, screenshots, transparency |
| JPEG | image/jpeg | Photos, complex images |
| GIF | image/gif | Simple animations |
| SVG | image/svg+xml | Vector graphics, logos |
| WebP | image/webp | Modern format, best compression |
Browser Compatibility
Data URLs are supported in all modern browsers. Maximum data URL size varies:
- Chrome: ~512MB
- Firefox: No hard limit
- Safari: ~2GB
- Edge: ~512MB
Related Tools
- Base64 String - Encode/decode text
- SVG to CSS - Convert SVG to CSS background-image
- URL Encode/Decode - URL encoding for data URLs