URL Parser
Breaks a URL into its components and query parameters
This tool runs in your browser. No data leaves your device.
- Protocol
- Origin
- Host
- Hostname
- Port
- Pathname
- Hash
- Username
- Password
Query parameters
| Key | Value |
|---|
How It Works
The WHATWG URL standard splits a URL into eight components: scheme, username,
password, host, port, path, query, fragment. This tool uses JavaScript’s
built-in URL class, which implements that standard — the fields below use its
property names (protocol, pathname, hash, …), add the derived origin and
hostname, and break the query string out into a separate parameter table.
WHATWG vs RFC 3986
It helps to know the two main specs:
- RFC 3986 — older, stricter. The IETF’s generic URI syntax.
- WHATWG URL Living Standard — modern, what browsers use. More forgiving.
Some URLs parse differently between the two specs. For example: should
http://example.com get a trailing /? (WHATWG: yes, RFC 3986: not required).
This tool uses the WHATWG version — the interpretation modern browsers use.
Common sources of bugs
URLSearchParamsalways returns values as strings. Reading?count=5means you have to doNumber(searchParams.get('count')).- Repeated parameters: for
?tag=a&tag=b,searchParams.get('tag')returns only the first value.searchParams.getAll('tag')returns both. - Percent encoding:
%20is a space, while+means a space only in the query string. In the pathname,+is a raw character. - IDN (internationalized domains): parsing
münir.comnormalizes it toxn--mnir-0ra.com(punycode).
Pathname trailing slash
Do /users and /users/ represent the same resource? In practice:
- REST APIs usually don’t distinguish them.
- Static file servers may distinguish them (
/usersredirects to/users/, which serves the index). - For SEO, pick one canonical form and redirect from the other.
Privacy
The URL you paste is processed entirely in your browser.