The same-origin policy (SOP) is the foundation of browser security: it stops a page on one origin from reading data from another. This tool compares two URLs, tells you precisely whether they are same-origin, and explains the consequences.
How it works
An origin is the combination of three things:
- Scheme (protocol) —
httpvshttps - Host (hostname) —
example.comvswww.example.comvsapi.example.com - Port — explicit, or the scheme default (
80for http,443for https)
Two URLs are same-origin only if all three match exactly. Everything after the host and port — the path, query string, and #fragment — is irrelevant to the origin.
The tool parses each URL with the browser’s own URL parser, normalises the port (filling in 80/443 when omitted), and compares the three components individually. It then reports which component, if any, caused a cross-origin result.
What a cross-origin result means
When two contexts are cross-origin, the browser blocks the calling page from reading the other’s data. Concretely:
fetch()/XMLHttpRequestcan send the request, but JavaScript cannot read the response body unless the server returns matching CORS headers.- A script cannot read the DOM, cookies (with the right flags), or
localStorageof a cross-origin iframe. - Canvas pixels drawn from a cross-origin image become “tainted” and unreadable.
Note the asymmetry: SOP primarily restricts reading, not sending. A cross-origin form submission still reaches the server, which is exactly why CSRF defences are still required.
Choosing the right cross-origin mechanism
| Need | Use |
|---|---|
| Read a cross-origin API response in JS | CORS (Access-Control-Allow-Origin) |
| Send messages between two windows/iframes | postMessage with a strict targetOrigin |
| Control who may embed your resources | CORP / COEP / X-Frame-Options |
| Legacy subdomain relaxation | document.domain — deprecated, avoid |
Use the narrowest mechanism that solves the problem, and never widen CORS to * for credentialed or sensitive endpoints. This checker runs entirely in your browser — the URLs you enter are never sent anywhere.