Guide
The anatomy of a URL
By Logappradeep · ServiceNow developer
A URL packs a lot into one line: which protocol to use, which server to contact, which resource to request, extra parameters and a position within the page. When you are debugging a redirect, an OAuth callback, a tracking link or a broken API call, seeing those parts separately saves time. This tool splits a URL into its components as you type.
The components
Consider https://shop.example.com:8080/products/shoes?color=red&size=10#reviews:
- Protocol
https:is the scheme, including its trailing colon. - Host
shop.example.com:8080is the hostname plus the port. - Port
8080. When a URL uses the scheme's default port (443 for HTTPS, 80 for HTTP), it is reported as empty, shown here as "(default)". - Path
/products/shoesidentifies the resource on the server. - Query
?color=red&size=10carries key-value parameters, listed in their own table. - Hash
#reviewsis the fragment, a position or state within the page. - Origin
https://shop.example.com:8080combines scheme, host and port. Browsers use the origin for security decisions such as CORS and cookie isolation.
How the parser works
The tool uses the browser's built-in URL class, which implements the WHATWG URL Standard, the same rules browsers use when you click a link. Query parameters are read with URLSearchParams, which decodes percent-escapes like %20. If the input cannot be parsed as an absolute URL, you will see an "Invalid URL" message. Everything happens locally; the URL is not requested or sent anywhere.
Practical uses
- Reading the parameters of a long marketing link with UTM tags.
- Checking the
redirect_uriorstatein an OAuth or SSO callback. - Verifying that a signed or pre-authenticated URL contains the expected fields.
- Comparing the origin of two URLs when debugging CORS errors.
Pitfalls
The fragment never reaches the server. Browsers strip everything after # before sending a request, so server-side code cannot read it. Single-page apps and OAuth implicit flows use it precisely for that reason.
Plus signs in queries. In the query string, + is decoded as a space, but in the path it stays a literal plus. Encode a real plus in a parameter as %2B.
Repeated keys. A query such as ?tag=a&tag=b is legal and many frameworks read it as a list. The parameter table here shows one row per key with the last value, so check the raw query when keys repeat.
Relative URLs and missing schemes. /path?x=1 or example.com on their own are not absolute URLs and will not parse; include the scheme.
Internationalized domains. Hostnames with non-ASCII characters are converted to their Punycode form beginning with xn--, which is the form DNS actually uses.