When do I actually need to URL-encode XML?
When the XML must travel inside the URL or an application/x-www-form-urlencoded body. SOAP-over-GET endpoints, SAML/XACML redirect parameters (SAMLRequest), legacy banking GET-style APIs, and form-based XML uploads all require percent-encoding so the angle brackets and ampersands do not collide with URL or form syntax.
Why does the tool validate the XML first?
A malformed document rarely gets healthier after percent-encoding — it just becomes a malformed encoded string. The tool runs DOMParser on your input first; if the parser flags a syntax error, encoding is blocked so you can fix the source. This catches mismatched tags, missing close brackets, and unbalanced quotes before they reach a server.
Should I XML-escape the content before URL-encoding?
Only if the receiver will parse the decoded value as a real XML document. In that case, your text content already needs & for & and < for <. URL encoding then escapes the whole thing again. If the receiver treats the value as an opaque blob, URL encoding alone suffices — XML-escaping a blob that nothing parses just adds noise.
What is the practical URL length limit?
Browsers vary, but most enforce a 2,000–8,000 character ceiling. After percent-encoding, every < / > / " / & costs three characters (%3C %3E %22 %26), so a small XML document can quickly exceed safe URL lengths. For payloads over a few hundred bytes, switch to a POST request with the XML as the body and use the appropriate Content-Type rather than a query parameter.
How does XML URL encoding differ from XML escaping?
XML escaping replaces < with < for use inside an XML document. URL encoding replaces < with %3C for use inside a URL. They produce different output for different contexts. URL encoding does not understand XML structure — it just escapes bytes. XML escaping respects element/attribute boundaries.
How are non-ASCII characters handled?
encodeURIComponent first converts each character to its UTF-8 byte sequence and then percent-encodes every byte. So é becomes %C3%A9 (two bytes), € becomes %E2%82%AC, and 🚀 becomes %F0%9F%9A%80 (four bytes). The output is always plain ASCII safe for any URL.
Why use encodeURIComponent and not encodeURI?
encodeURI assumes you are encoding a complete URL and leaves URL-structural delimiters (?, &, /, #, etc.) untouched. That is the wrong behaviour for XML embedded in a parameter — a literal & inside the XML would survive encoding and the receiving server would misparse the query string. encodeURIComponent escapes those delimiters too, which is exactly what an XML parameter value needs.
Is my XML uploaded to a server?
No. Validation and encoding both run in your browser. SOAP envelopes, SAML assertions, and any tokens or PII in the payload never leave the page. Verify in DevTools → Network — no request fires when you click Encode.