Skip to content
uencoder

Base64 XML-Safe

Base64 XML-Safe is a Base64 variant adapted for XML documents, ensuring the output contains no XML-special characters or is wrapped in a CDATA section.

Purpose

It lets binary data be embedded safely in XML element content without colliding with XML syntax characters (<, >, &).

Mechanism

Standard Base64 output never contains <, >, or &, but it does contain +, /, and =; inside XML the payload is usually embedded directly or wrapped in a CDATA section, or the Base64URL alphabet is used instead.

Use cases

  • Binary embedding in XML configuration
  • SOAP attachment encoding
  • SAML assertion attributes

Related tools

References