URL Parser

Break a URL into its components and query parameters

Runs in your browserDebugging07Network & Web

What is URL Parser?

A URL parser that splits a full address into scheme, host, port, path, query parameters, and fragment, then expands the query string into a key-value table. It uses the native URL API built into the browser, so parsing happens on your machine and nothing is sent anywhere.

How to use URL Parser

  1. 1Paste a complete URL, including the scheme (for example https://).
  2. 2Review the component breakdown and the parameter table.
  3. 3Repeated parameters are all listed separately rather than overwriting one another.
  4. 4Percent-encoded parameter values are shown decoded alongside the raw form.

How do I do this in code?

Use the tool above for one-off work; for anything you repeat, move it into a script or your project.

const url = new URL('https://a.com:8443/p/1?q=x&tag=a&tag=b#top');

url.protocol;                  // 'https:'
url.host;                      // 'a.com:8443'
url.pathname;                  // '/p/1'
url.searchParams.getAll('tag'); // ['a', 'b']

Common errors and how to fix them

SymptomCauseFix
The parser throws "Invalid URL"The scheme prefix is missing, for example passing www.example.com on its own.Prepend https:// before parsing, or supply a base URL as the second argument to URL.

Frequently asked questions

If the same query parameter appears twice, which value does the server use?+

There is no single standard; it depends on the framework. Express gives you an array, PHP keeps the last occurrence, and some gateways keep the first. Never design an API that depends on the ordering of duplicate keys: use explicit array syntax when you need multiple values, or move the data into a POST body.

Is the fragment after the # sent to the server?+

No. Everything after the # stays inside the browser and is never included in the HTTP request, which is why it never shows up in server logs or backend code. Hash-based client-side routing relies on exactly this behaviour.

Related tools

All tools