Data URI to Image Converter
Convert Data URI base64 strings to downloadable images. Extract metadata, preview, and save PNG/JPG/GIF/WebP from encoded data.
Converted Image
About
Data URIs embed images directly in HTML/CSS as base64-encoded strings, eliminating HTTP requests but increasing document size by approximately 33%. This converter extracts the binary image data from URIs following RFC 2397 specification, validating the MIME type header and base64 padding. Malformed URIs lacking proper data: prefix or containing invalid base64 characters will fail decoding, potentially breaking production deployments. The tool handles standard formats: PNG, JPEG, GIF, WebP, SVG, and BMP.
Base64 encoding maps binary data to 64 ASCII characters using A−Z, a−z, 0−9, +, / alphabet. Each 3 bytes become 4 characters, with = padding for incomplete triplets. Modern browsers limit Data URI size to 2MB in attributes, though this varies. CSS implementations may accept larger values.
Formulas
Data URI structure follows the RFC 2397 format:
File size calculation from base64 string:
where Lbase64 = length of base64 string, P = padding count (number of = characters)
Encoding efficiency ratio:
Reference Data
| Format | MIME Type | Magic Bytes (Hex) | Max Colors | Transparency | Compression |
|---|---|---|---|---|---|
| PNG | image/png | 89 50 4E 47 | 16.7M (24-bit) | Alpha channel | Lossless (DEFLATE) |
| JPEG | image/jpeg | FF D8 FF | 16.7M (24-bit) | None | Lossy (DCT) |
| GIF | image/gif | 47 49 46 38 | 256 (8-bit) | Binary (1-bit) | Lossless (LZW) |
| WebP | image/webp | 52 49 46 46 | 16.7M (24-bit) | Alpha channel | Both modes |
| SVG | image/svg+xml | 3C 73 76 67 | Unlimited | Native | Text (GZIP) |
| BMP | image/bmp | 42 4D | 16.7M (24-bit) | Optional (32-bit) | None (raw) |
| ICO | image/x-icon | 00 00 01 00 | 16.7M (24-bit) | Alpha channel | None/PNG |
| AVIF | image/avif | 00 00 00 20 | 10-bit/12-bit | Alpha channel | Lossy (AV1) |
| TIFF | image/tiff | 49 49 2A 00 | 48-bit | Alpha channel | Multiple |
| WebP Anim | image/webp | 52 49 46 46 | 16.7M (24-bit) | Alpha channel | VP8/VP8L |