DeveloperKit

XML to Base64 Encoder

Validate and encode XML as Base64 or base64url instantly. Free, private, and 100% in your browser.

Input XML

Base64 Output

Base64 output will appear here.

Encode XML to Base64 Online

SOAP and SAML messages, document exports, and SVG images are often transported as Base64-encoded XML. This encoder checks that your XML is well-formed and then converts it to standard Base64 or URL-safe base64url.

Features

  • Validates first

    Your XML is checked for well-formedness before encoding, with exact line and column errors.

  • Minify before encoding

    Encode exactly as typed, minified to save space, or pretty-printed.

  • Full UTF-8 support

    Non-ASCII characters are encoded correctly as UTF-8, unlike the browser's btoa().

  • SVG data URIs

    Encode SVG images to embed them in CSS or HTML as data:image/svg+xml;base64 URIs.

  • base64url and MIME

    Use the URL-safe alphabet, or wrap lines at 76 characters for email and MIME.

  • Private by design

    Encoding runs entirely in your browser. Your data is never uploaded.

XML to Base64 Example

XML input
<order id="1042"><item sku="A-100">Keyboard</item></order>
Base64 output
PG9yZGVyIGlkPSIxMDQyIj48aXRlbSBza3U9IkEtMTAwIj5LZXlib2FyZDwvaXRlbT48L29yZGVyPg==

How to Encode XML to Base64

  1. Paste your XML into the input editor, or upload an .xml or .svg file.
  2. Choose whether to encode it as typed, minified, or pretty-printed.
  3. Enable URL-safe or line wrapping if you need them.
  4. Copy the Base64 output or download it as a text file.

Frequently Asked Questions

Why encode XML as Base64?

Base64 lets you safely embed XML inside other formats: SOAP attachments, JSON fields, SAML messages, email (MIME), and data URIs. It avoids problems with quotes, angle brackets, and line breaks.

How do I use an SVG as a data URI?

Paste the SVG markup, copy the Base64 output, and prefix it with data:image/svg+xml;base64, for use in CSS background-image or an img src attribute.

Should I minify XML before encoding?

Minifying removes whitespace between elements, which makes the Base64 output shorter. Choose As typed if the exact original text matters, for example for signed XML.

Is my XML uploaded anywhere?

No. Encoding runs entirely in your browser. Your XML never leaves your device.

  • Base64 to XML

    Decode Base64 into well-formed, validated, and formatted XML.

  • XML to JSON

    Convert XML to JSON with attributes, repeated elements as arrays, and automatic number and boolean detection.

  • XML to YAML

    Convert XML documents and configs into clean, readable YAML.

  • XML to CSV

    Turn repeated XML records into a CSV table for Excel or Google Sheets, with automatic row detection.