toolqik

69 · API & Webhooks

URL Parser

Break a URL into scheme, host, port, path, query and fragment, and resolve links.

Runs in your browser
Components
Query parameters

Resolve a relative link against this URL

About this tool

URLs pack a lot into one line: scheme, credentials, host, port, path, query and fragment. This parser splits any URL into its components using your browser’s own URL parser (the WHATWG standard every browser and Node.js use), so you see exactly how software will interpret it, including normalisation such as default ports being dropped and paths being cleaned up.

Anatomy of a URL

https://ada:secret@shop.example.com:8443/en/products?color=red#reviews
└─┬─┘   └───┬────┘ └──────┬───────┘ └┬─┘└─────┬────┘ └───┬───┘ └──┬──┘
scheme   userinfo        host        port    path       query   fragment
  • Origin = scheme + host + port. Browsers use it for same-origin rules, CORS and cookies.
  • The fragment (after #) never reaches the server; it stays in the browser.
  • Credentials in URLs are deprecated and end up in logs; the parser warns about them.

Resolving relative links

Links like ../img/logo.png or ?page=2 are resolved against the current page’s URL. Enter one in the box under the parser to see the absolute result, which is handy when debugging broken links, redirects and crawlers.

FAQ

How do I parse a URL in JavaScript?

Use new URL(text). Its properties (protocol, hostname, port, pathname, search, searchParams and hash) are exactly what this page shows.

What is the difference between host and hostname?

hostname is the domain or IP only; host also includes the port when it isn’t the default, such as shop.example.com:8443.

Is the URL fragment sent to the server?

No. Everything after # stays in the browser, which is why single-page apps used it for routing.

What does “origin” mean?

Scheme, host and port together. Two URLs with the same origin can share cookies and call each other without CORS.

esc
↑↓ navigate↵ open