Share Results via URL
Compare HTML can encode comparison inputs into URL query parameters, so you can share a diff with teammates or link to it from documentation without sending the HTML through a server.
How URL Sharing Works
All sharing happens through the /result page. The page reads the base and contrast query parameters, resolves them, and runs the comparison automatically.
https://comparehtml.com/result?base=...&contrast=...
Because the comparison runs in the browser, the shared URL contains the raw data or a link to it, not a server-side snapshot.
Method 1: Load HTML from File URL
Pass publicly accessible URLs to the base and contrast parameters.
https://comparehtml.com/result?base=https://comparehtml.com/example_data/demo.base.html&contrast=https://comparehtml.com/example_data/demo.contrast.html
When the result page loads, it fetches both URLs and compares the HTML content automatically. This method keeps the URL short and is useful for sharing comparisons of files stored in version control or cloud storage.
Method 2: Load HTML from Base64
Encode each HTML document as a Base64 string and pass it directly in the URL.
<div>
<p>Base HTML content</p>
</div>
<div>
<p>Contrast HTML content</p>
</div>
The Base64-encoded values produce this shareable URL:
https://comparehtml.com/result?base=PGRpdj48cD5CYXNlIEhUTUwgY29udGVudDwvcD48L2Rpdj4=&contrast=PGRpdj48cD5Db250cmFzdCBIVE1MIGNvbnRlbnQ8L3A+PC9kaXY+
You can encode your own HTML with base-64.com. This method is self-contained and works with any HTML that can be Base64 encoded. Keep in mind that very large HTML values can produce long URLs.
Security and Privacy
- Shared URLs contain the HTML data or links to it. Share them only with people who should have access.
- Remote HTML files must be publicly accessible and served with appropriate CORS headers.
- Compare HTML does not store comparison inputs on a server. The URL is the only transport mechanism.