XML to Base64

Validate and encode XML to Base64, or decode Base64 back to XML.

0 chars
0 words
0 lines
0 chars
0 words
0 lines

XML to Base64 Encoder and Decoder

Convert XML documents to Base64 and decode Base64 back to XML right in your browser. Before encoding, the tool can check that your XML is well-formed, so you catch a missing closing tag or an unescaped ampersand before the payload reaches a SOAP endpoint, an identity provider, or a message broker.

Where Base64-encoded XML is used

  • SAML single sign-on – the SAMLResponse and SAMLRequest parameters are Base64-encoded XML. Paste one into Base64 to XML to inspect the assertion, issuer, and attributes while debugging a login.
  • SOAP and web services – binary-safe XML attachments and xs:base64Binary fields.
  • Office and e-invoicing formats – UBL and national e-invoice systems often wrap the XML document in Base64 inside an API envelope.
  • Configuration management – storing XML settings in JSON, YAML, or environment variables without quoting headaches.
  • Data URIs – enable Output as data URI to get data:application/xml;base64,... for a downloadable link or an XSLT reference.

Validation in the browser

With Validate XML turned on, the input is parsed by the browser's DOMParser using the application/xml content type. Any parser error is shown instead of the Base64 output. For example, <a><b></a> is rejected because <b> is never closed, and <name>Tom & Jerry</name> fails because a bare & must be written as &amp;. Turn validation off to encode XML fragments or deliberately broken test data.

Round-trip safety

Encoding is done on UTF-8 bytes, so characters like ü and ö in the sample survive untouched, and indentation and comments are kept byte for byte. You can also load an .xml file directly. To escape XML special characters instead of encoding the whole document, use XML Escape / Unescape. For HTML pages try HTML to Base64.

Frequently Asked Questions

It parses the input with your browser's built-in XML parser and reports well-formedness errors such as unclosed tags, mismatched element names, unescaped & characters, or text after the root element. It does not validate against an XSD or DTD schema.

A SAML assertion is posted as a form field and a SOAP attachment may travel inside another XML document. Base64 guarantees that angle brackets, quotes, and non-ASCII characters can't break the surrounding markup or HTTP form encoding.

The text is always encoded as UTF-8, which is also the XML default. If your declaration says encoding="ISO-8859-1" but you encode it here, change the declaration to UTF-8 so parsers on the other side read special characters correctly.