Load XML Results via URL
Load Base64-encoded XML or remote XML files through result-page query parameters.
Compare XML can load comparison inputs from URL query parameters, so you can open a diff directly from a link or documentation. Parsing and comparison run in your browser.
How URL Loading Works
URL loading happens through the XML result page. It reads the base and contrast query parameters, decodes them, and runs the comparison automatically.
https://comparejson.com/tools/compare-xml/result?base=...&contrast=...
Always apply encodeURIComponent to each complete base and contrast value. Unencoded & or # in a signed remote URL can break query parsing.
const url = `https://comparejson.com/tools/compare-xml/result?base=${encodeURIComponent(baseValue)}&contrast=${encodeURIComponent(contrastValue)}`;
Base64 mode stores the encoded XML itself in the URL. Remote URL mode stores source addresses, and your browser requests those sources. Neither mode creates a server-side snapshot.
Method 1: Load XML from File URLs
Pass publicly accessible HTTP/HTTPS URLs to base and contrast, percent-encoding each source address with encodeURIComponent.
https://comparejson.com/tools/compare-xml/result?base=https%3A%2F%2Fcomparejson.com%2Fexample_data%2Fdemo.base.xml&contrast=https%3A%2F%2Fcomparejson.com%2Fexample_data%2Fdemo.contrast.xml
When the result page loads, your browser requests both sources and compares their XML automatically. This keeps the link shorter than embedding both documents and works well for files in version control or cloud storage.
GitHub Gist URLs are supported too. A gist page URL resolves to its raw file content, so you do not need to copy the raw address manually. For example:
https://comparejson.com/tools/compare-xml/result?base=https%3A%2F%2Fgist.github.com%2Funitstack%2F689488c928052e85e67e6d71564de72f%2Fraw%2Fdemo.base.xml&contrast=https%3A%2F%2Fgist.github.com%2Funitstack%2F689488c928052e85e67e6d71564de72f%2Fraw%2Fdemo.contrast.xml
Method 2: Load XML from Base64
Encode each XML document as Base64, then apply encodeURIComponent to the encoded value before assigning it to base or contrast.
<root><message>base base64String</message></root>
<root><message>contrast base64String</message></root>
The percent-encoded Base64 values produce this URL:
https://comparejson.com/tools/compare-xml/result?base=PHJvb3Q%2BPG1lc3NhZ2U%2BYmFzZSBiYXNlNjRTdHJpbmc8L21lc3NhZ2U%2BPC9yb290Pg%3D%3D&contrast=PHJvb3Q%2BPG1lc3NhZ2U%2BY29udHJhc3QgYmFzZTY0U3RyaW5nPC9tZXNzYWdlPjwvcm9vdD4%3D
You can encode XML with base-64.com or your own tooling. This mode is self-contained, but large documents can produce URLs that are too long for browsers, chat tools, or link shorteners.
Security and Privacy
- Shared URLs contain the XML or links to it. Send them only to people who should have access.
- Remote XML files must be publicly accessible and served with appropriate CORS headers. Importing from a URL sends a request to the source you specify.
- Base64-encoded data in a URL is sent with page requests and may be recorded in hosting service logs. Do not place sensitive data in URLs.
- To create a short server-hosted snapshot instead, see Share XML Results.