Data URI to PNG Converter
Convert base64 Data URI strings to downloadable PNG images. Supports JPEG, GIF, WebP, BMP, and SVG source formats with instant preview.
About
Data URIs encode binary image data as base64 ASCII strings following RFC 2397 specification. The format data:[mediatype][;base64],data embeds resources directly in HTML or CSS, eliminating HTTP requests but inflating payload size by approximately 33% due to base64 encoding overhead. This converter decodes the base64 payload, renders to an HTML5 Canvas element, and exports as lossless PNG format. Supported input types include image/jpeg, image/gif, image/webp, image/bmp, and image/svg+xml. Misconfigured Data URIs cause broken images in production deployments. Invalid base64 padding or corrupted character sequences fail silently in browsers, making debugging difficult without proper validation tooling.
Formulas
The base64 encoding algorithm transforms binary data into ASCII characters using a 64-character alphabet. Each group of 3 bytes (24 bits) maps to 4 base64 characters (6 bits each).
To calculate the original binary size from a base64 string:
Where len is the base64 string length (excluding header) and padding is the count of trailing = characters (0, 1, or 2). The Data URI format follows RFC 2397 specification:
Canvas export converts all source formats to PNG using lossless DEFLATE compression. The output file size depends on image complexity, not source format.
Reference Data
| Source MIME Type | Typical Header | Compression | Alpha Support | Max Colors | Use Case |
|---|---|---|---|---|---|
| image/png | data:image/png;base64, | Lossless (DEFLATE) | Yes (8-bit) | 16.7M (24-bit) | Icons, screenshots, transparency |
| image/jpeg | data:image/jpeg;base64, | Lossy (DCT) | No | 16.7M (24-bit) | Photographs, gradients |
| image/gif | data:image/gif;base64, | Lossless (LZW) | Yes (1-bit) | 256 (8-bit) | Simple animations, logos |
| image/webp | data:image/webp;base64, | Lossy/Lossless | Yes (8-bit) | 16.7M (24-bit) | Web optimization |
| image/bmp | data:image/bmp;base64, | None (raw) | Limited | 16.7M (24-bit) | Legacy systems |
| image/svg+xml | data:image/svg+xml;base64, | Text (gzip-able) | Yes | Unlimited (vector) | Scalable graphics |
| Base64 Encoding Overhead | |||||
| Original Size | Encoded Size | Overhead Ratio | |||
| 1 KB | 1.37 KB | +37% | |||
| 10 KB | 13.7 KB | +37% | |||
| 100 KB | 137 KB | +37% | |||
| 1 MB | 1.37 MB | +37% | |||
| Data URI Length Limits by Context | |||||
| Context | Maximum Length | Notes | |||
| Modern Browsers (Chrome, Firefox, Safari) | ~2 GB | Practical limit: available memory | |||
| Internet Explorer 8 | 32 KB | Strict hard limit | |||
CSS background-image | No hard limit | Performance degrades >100 KB | |||
HTML src attribute | No hard limit | Blocks HTML parsing for large URIs | |||
| HTTP GET URL | ~2048 chars | Server-dependent | |||