Base64 to XML Converter
Convert Base64-encoded strings to XML and XML to Base64. Decode, validate, pretty-print, and download XML with full UTF-8 support.
About
Base64 encoding represents binary or text data as an ASCII string using a 64-character alphabet (A - Z, a - z, 0 - 9, +, /). XML payloads transmitted through APIs, SOAP envelopes, or embedded in JSON frequently arrive Base64-encoded. Decoding errors - particularly with multi-byte UTF-8 sequences such as &, <, or non-Latin characters - corrupt document structure and break downstream parsers. This tool decodes Base64 to raw XML with proper UTF-8 reconstruction, validates well-formedness via the browserβs native DOMParser, and applies structural pretty-printing. It also encodes XML back to Base64 for storage or transport.
The converter handles padding normalization (missing = characters), detects binary-vs-text content, and reports exact parser error locations. Limitation: this tool validates XML well-formedness, not schema conformance (XSD/DTD validation requires a server-side process). For SOAP debugging, ensure the Base64 payload does not include a BOM prefix (0xEF 0xBB 0xBF) unless your parser expects it.
Formulas
Base64 encoding maps every group of 3 input bytes (24 bits) to 4 printable ASCII characters (6 bits each).
Where nin = number of input bytes and nout = number of Base64 output characters (including padding). Each sextet index i maps to the character T[i] in the alphabet table.
Decoding reverses this: each Base64 character is resolved to its 6-bit value, concatenated into a bitstream, and split into 8-bit bytes. For UTF-8 XML content, multi-byte sequences (characters above U+007F) require reassembly: a 2-byte sequence uses bits 110xxxxx 10xxxxxx, a 3-byte uses 1110xxxx 10xxxxxx 10xxxxxx, and a 4-byte uses 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx. The browserβs native atob returns a Latin-1 string; proper UTF-8 reconstruction requires passing through Uint8Array and TextDecoder.
XML well-formedness is validated by parsing with DOMParser and checking for the presence of a parsererror element in the resulting document tree.
Reference Data
| Base64 Character | Decimal Value | Binary | Notes |
|---|---|---|---|
| A | 0 | 000000 | Index start |
| Z | 25 | 011001 | End uppercase |
| a | 26 | 011010 | Start lowercase |
| z | 51 | 110011 | End lowercase |
| 0 | 52 | 110100 | Start digits |
| 9 | 61 | 111101 | End digits |
| + | 62 | 111110 | Standard alphabet |
| / | 63 | 111111 | Standard alphabet |
| = | - | - | Padding character |
| - | 62 | 111110 | URL-safe variant replaces + |
| _ | 63 | 111111 | URL-safe variant replaces / |
| Encoding Ratios | |||
| Input size | 3 bytes β 4 Base64 characters | ||
| Output overhead | ~33% size increase | ||
| Padding rule | Input mod 3 = 1 β ==; mod 3 = 2 β = | ||
| Common XML Encoded Entities | |||
| < | Less-than: < | ||
| > | Greater-than: > | ||
| & | Ampersand: & | ||
| ' | Apostrophe: ' | ||
| " | Quotation mark: " | ||
| XML Declaration Defaults | |||
| Version | 1.0 (required) | ||
| Encoding | UTF-8 (default if omitted) | ||
| Standalone | yes or no | ||