XML to Base64
Encode XML to Base64 and decode it back. Need JSON instead? Try JSON to Base64.
Example
The XML <user id="7"/> encodes to PHVzZXIgaWQ9IjciLz4=. In code you would do:
const xml = '<user id="7"/>';
const b64 = btoa(unescape(encodeURIComponent(xml))); // "PHVzZXIgaWQ9IjciLz4="
const back = decodeURIComponent(escape(atob(b64)));XML to Base64 — FAQ
How do I Base64 encode XML?+
Paste your XML above and switch to Encode. The tool treats it as UTF-8 text and returns a Base64 string safe to embed in JSON, headers or config files.
Why Base64 encode XML at all?+
To move XML safely through channels that mishandle angle brackets, quotes or namespaces — for example embedding an XML payload inside a JSON field, a SOAP attachment, or a URL parameter.
Does encoding XML to Base64 keep it valid?+
Decoding returns the exact original XML text, character for character, so it stays valid as long as your input was valid XML.
Is this the same as XML canonicalization (C14N)?+
No. Base64 just makes XML text-safe for transport; it does not normalize whitespace, attribute order or namespaces the way C14N does for XML digital signatures.