URL parser
Every web address packs several pieces of information into one string: the scheme, the authority (host and optional port), an optional path, a query string, and a fragment. This parser splits any absolute URL into those components using the browser’s native URL API, so the breakdown matches exactly how browsers and servers interpret the address — useful for debugging links, reading long tracking URLs, dissecting API endpoints, or building integrations.
Anatomy of a URL
The RFC 3986 structure of a URL is:
scheme "://" [userinfo "@"] host [":" port] path ["?" query] ["#" fragment]
For example:
https://user:[email protected]:8443/products/shoes?id=42&ref=email#reviews
│ │ │ │ │ │ │
scheme userinfo hostname port path query fragment
Most URLs omit the userinfo and port. The path, query, and fragment are each optional too.
How it works
The tool constructs a URL object from your input and reads its standard properties:
- Protocol (
https:,ftp:, etc.) — the scheme including the trailing colon - Username and password — present in URLs like
ftp://user:pass@host; typically empty in web URLs - Hostname — the domain without port (
shop.example.com) - Host — hostname plus port when a non-default port is present (
shop.example.com:8443) - Port — only the port number when explicitly given; empty if the default port for the scheme is used
- Origin — scheme + hostname + port; the unit browsers use for same-origin security checks
- Pathname — the path portion starting with
/ - Search — the raw query string including the leading
? - Hash — the fragment including the leading
#
It then walks the query string with URLSearchParams, percent-decoding each parameter automatically, and lists each key–value pair individually.
Worked example
Input URL: https://shop.example.com:8443/products?id=42&ref=email%40domain.com#reviews
| Component | Value | Notes |
|---|---|---|
| Protocol | https: | Scheme with colon |
| Hostname | shop.example.com | No port |
| Port | 8443 | Non-default HTTPS port |
| Origin | https://shop.example.com:8443 | Scheme + host + port |
| Pathname | /products | Path only |
| Search | ?id=42&ref=email%40domain.com | Raw, still encoded |
| Hash | #reviews | Fragment |
| Query: id | 42 | Decoded |
| Query: ref | [email protected] | %40 decoded to @ |
The query parameter ref is shown decoded — [email protected] rather than email%40domain.com — because URLSearchParams decodes values automatically.
The fragment is never sent to the server
The hash / fragment (#reviews in the example above) is handled entirely by the browser. It is stripped from the HTTP request before it is sent to the server, which is why server logs never show it. It is used for:
- In-page anchors: scrolling to a specific heading or element
- Single-page-app routing: React Router, Vue Router, and similar libraries use the hash to represent the current view without making a server request
- OAuth redirect parameters: some OAuth flows carry tokens in the fragment specifically because it is not sent to the server
Common reasons a URL fails to parse
The URL API requires an absolute URL with a scheme. Common problems:
| Input | Problem | Fix |
|---|---|---|
example.com/path | No scheme | Add https:// → https://example.com/path |
/path?q=1 | Relative URL | Needs a base URL; add the full origin |
javascript:alert() | Invalid scheme for this parser | Supply an http/https URL |
| URLs with spaces | Spaces are not allowed unencoded | Encode as %20 first |
Everything runs in your browser using the built-in URL API — nothing is uploaded.