Data URI to UTF8 Converter
Convert Data URIs to readable UTF-8 text. Decode Base64 and percent-encoded Data URLs instantly with MIME type detection.
About
Data URIs embed file content directly into documents using the data: scheme, encoding binary or text as Base64 or percent-encoded strings. Malformed decoding corrupts special characters - รฉ becomes รยฉ, breaking internationalized content. This tool parses the URI structure, detects encoding type (Base64 flag ;base64 or implicit percent-encoding), extracts the MIME type, and reconstructs the original UTF-8 byte sequence using the TextDecoder API. Multi-byte characters (Chinese, Arabic, emoji) require proper byte-level reconstruction, not naive character-by-character conversion.
Common failure modes: truncated Base64 padding causes InvalidCharacterError, unescaped + symbols decode as spaces in URL contexts, and BOM markers (0xEF 0xBB 0xBF) may prefix UTF-8 payloads. The tool handles these edge cases and displays the extracted MIME type for verification. Useful for debugging embedded images in CSS, decoding API responses, or extracting text from data URLs in email templates.
Formulas
Data URI structure follows RFC 2397 specification. The parser extracts components using pattern matching:
where mimeType defaults to text/plain;charset=US-ASCII if omitted. Base64 decoding converts the ASCII payload to binary bytes:
UTF-8 reconstruction processes the byte array through TextDecoder:
For percent-encoded URIs (without ;base64 flag), decoding applies the inverse transformation:
Multi-byte UTF-8 sequences follow the encoding pattern where byte count n is determined by leading bits:
Reference Data
| MIME Type | Common Use | Typical Encoding | Max Practical Size |
|---|---|---|---|
| text/plain | Plain text embedding | Base64 / Percent | ~2KB (URL limits) |
| text/html | Inline HTML frames | Base64 | ~32KB |
| text/css | Embedded stylesheets | Base64 | ~64KB |
| text/javascript | Inline scripts | Base64 | ~32KB |
| application/json | Configuration data | Base64 / Percent | ~128KB |
| application/xml | SVG, config files | Base64 | ~64KB |
| image/svg+xml | Vector graphics | Base64 / Percent | ~96KB |
| image/png | Raster images | Base64 | ~128KB |
| image/jpeg | Photos | Base64 | ~96KB |
| image/gif | Animations | Base64 | ~64KB |
| image/webp | Modern images | Base64 | ~128KB |
| font/woff | Web fonts | Base64 | ~256KB |
| font/woff2 | Compressed fonts | Base64 | ~192KB |
| audio/mpeg | Sound effects | Base64 | ~512KB |
| audio/wav | Uncompressed audio | Base64 | ~256KB |
| video/mp4 | Short clips | Base64 | ~1MB |
| application/pdf | Documents | Base64 | ~512KB |
| application/octet-stream | Binary fallback | Base64 | ~256KB |
| text/csv | Spreadsheet data | Base64 / Percent | ~64KB |
| application/x-www-form-urlencoded | Form data | Percent | ~8KB |