Base64 to XML Converter

Decode Base64 into XML, confirm it is well-formed, and re-indent it so you can actually read it.

Base64
XML
Runs locally in your browser

About the Base64 to XML Converter

SOAP envelopes, SAML assertions, signed invoices and enterprise message queues all move XML around as Base64, usually squeezed onto one enormous line. Decoding it is only half the job, because a single line document with forty nested elements is no easier to inspect than the Base64 was.

This tool decodes the string, parses the result to confirm the tags balance, and rebuilds it with two space indentation. Attributes stay on their element, text nodes are trimmed, comments and CDATA sections are preserved on their own lines, and empty elements collapse to self closing form. The status line names the root element, which is a quick way to check you decoded the message you meant to.

By default a document that fails to parse is still shown, so you can look at whatever arrived and find the truncation or the stray ampersand yourself. Ticking the strict option turns that into a hard error instead, which is what you want in a checking workflow where a malformed message should stop the process. Namespace prefixes are left exactly as written, since rewriting them would change the meaning.

Follow up with XML Formatter for other indent widths, XML Validator for detailed error positions, or XML to JSON to convert the decoded document.

How to use

  1. Paste the Base64 encoded XML into the left pane.
  2. Leave Re-indent the result ticked to turn a single line document into a readable tree.
  3. Tick Fail if the XML is not well-formed when a broken message should be rejected outright.

Common questions

Is the XML declaration kept?
The declaration is dropped when the document is re-indented, because the output is text rather than a saved file. Switch re-indenting off to keep the original bytes.
Are namespace prefixes preserved?
Yes. Prefixes and xmlns attributes are written back exactly as they appeared, since changing them would change the document.
Can it decode a SAML assertion?
It decodes plain Base64. SAML redirect bindings also deflate the assertion, so those need decompressing first.
What happens to CDATA sections?
They are preserved verbatim on their own line, so escaped scripts and markup inside them stay intact.