How to Convert Base64 to XML
XML gets wrapped in Base64 whenever it has to travel inside another message: a document attached to a SOAP envelope, the SAML response your identity provider posts back after login, an XML config kept in a database column or a JSON field. Paste the string below to read the XML and save it as a file.
Paste the Base64 string
Paste the string into the input panel or upload a .txt, .b64 or .base64 file that holds it. The Sample button loads a small library catalogue.
Example: Try This Base64 Encoded XML
Note how it starts with PD94bWwg, the Base64 form of <?xml :
PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPGN1c3RvbWVyPgogIDxuYW1lPk1hcmsgV2lsc29uPC9uYW1lPgogIDxlbWFpbD5tYXJrQGV4YW1wbGUuY29tPC9lbWFpbD4KICA8YWdlPjM1PC9hZ2U+CiAgPGFkZHJlc3M+CiAgICA8Y2l0eT5OZXcgWW9yazwvY2l0eT4KICAgIDxzdGF0ZT5OWTwvc3RhdGU+CiAgICA8emlwPjEwMDAxPC96aXA+CiAgPC9hZGRyZXNzPgo8L2N1c3RvbWVyPg==
Read the decoded XML
A moment after you paste, the XML appears in the output panel exactly as it was encoded, with a Well-formed XML badge if the browser can parse it. Broken Base64, a cut-off string or a file that is not text gets a message saying what went wrong.
Decoded XML Output
The example above decodes to exactly this:
<?xml version="1.0" encoding="UTF-8"?> <customer> <name>Mark Wilson</name> <email>mark@example.com</email> <age>35</age> <address> <city>New York</city> <state>NY</state> <zip>10001</zip> </address> </customer>
Copy or download it
Copy the XML to your clipboard, or download converted.xml, which holds the decoded bytes exactly as they were.
What is Base64 to XML Conversion?
Base64 turns any bytes into letters, digits, + and /. XML is full of angle brackets, quotes and ampersands that would clash with the message carrying it, so SOAP, SAML and many APIs send it as Base64 instead. Decoding reverses that: the bytes come back and are read as text again.
This page decodes the string, reads the bytes as UTF-8 (or UTF-16, or the encoding the XML declaration names), shows the result without touching it, and asks the browser's XML parser whether it is well-formed.
Frequently Asked Questions
Where does Base64-encoded XML usually come from?
From anywhere XML has to ride inside something else. SOAP services send attached documents as Base64 inside the envelope, SAML identity providers post the whole login response as Base64 (it usually starts with PHNhbWxw, which is how <samlp begins), and apps keep XML config blobs in a database column, an environment variable or a JSON field as Base64 so the angle brackets and quotes cannot break anything. A string that starts with PD94bWwg is almost always XML: it is how <?xml looks once encoded.
Does this page change my XML in any way?
No. The Base64 is turned back into its bytes and shown as text without being re-indented or re-serialised. Text values such as 8901240544102066246, 00501 or 14.50, CDATA sections, entities like &, attribute order, xmlns declarations, comments, the XML declaration and Windows line endings all stay exactly as they were encoded. The download is the decoded bytes themselves, including a byte-order mark if the original had one.
How do I know the decoded XML is valid?
After decoding, the browser's own XML parser checks the text. If it parses, you see a Well-formed XML badge. If it does not, the text is still shown as it was decoded, with a note naming the line and column of the first problem, such as a closing tag that does not match or an undeclared namespace prefix. Well-formed only means the syntax is correct; the page does not check the XML against a schema or WSDL.
What if the XML is UTF-16 or uses an older encoding?
UTF-16 XML, with or without a byte-order mark, is detected and shown as normal text, and the download keeps the original UTF-16 bytes. If the bytes are not valid UTF-8, the encoding named in the XML declaration is used (ISO-8859-1, for example), falling back to Windows-1252, and a note tells you so.
It says the data is not XML text. What does that mean?
The Base64 decoded fine, but the bytes are a file rather than readable text: an image, a PDF, a ZIP archive (a .docx is one), or compressed data. SAML responses sent through a redirect are often deflate-compressed before they are encoded, so they come out as binary here. Base64 to File saves the decoded bytes as a file you can open or decompress.
Is a SAML response safe to decode here, and is Base64 a form of protection?
Base64 is not encryption. Anyone holding the string can read it in a second, exactly as this page does, and SAML responses often contain names, email addresses and group memberships. Decoding here runs in JavaScript in your browser: nothing you paste is uploaded or kept, and a reload starts with an empty editor. Only the Share button sends the Base64 to our server, and only when you click it.
Related pages: XML to Base64 · Base64 to File · XML Validator
Related Tools
Text to Base64
Encode plain text to Base64 format for APIs and data transmission
Base64 to Text
Decode Base64 encoded data to plain text for reading and debugging
JSON to Base64
Convert JSON data to Base64 format with validation
Base64 to JSON
Convert Base64 encoded data to JSON format with validation
XML to Base64
Convert XML data to Base64 format with validation
YAML to Base64
Convert YAML data to Base64 format with validation