URL parser

Parse a URL into its parts instantly

Paste a URL and get protocol, username, password, hostname, port, path, and params — all in your browser

Last updated: January 29, 2026
Frank Zhao - Creator
CreatorFrank Zhao
Protocol
Username
Password
Hostname
Port
Path
Params

Introduction / overview

The URL Parser takes a URL string and splits it into the parts you normally care about: protocol, username/password, hostname, port, path, and the raw query string.

Practical idea: when an API request fails, the bug is often in a tiny URL detail (a missing slash, a wrong port, an extra query key, or an unescaped character).

Who is this for?

  • Developers debugging redirects, proxies, and request signing.
  • QA testers verifying deep links and campaign URLs.
  • Security reviewers checking for credential leaks in URLs.

If you need to percent-encode or decode query values, pair this with our Encode/decode URL-formatted strings tool.

How to use / quick start

1

Paste the URL

Put the full URL in the input box. Include the protocol when possible (for example https:\texttt{https:}).

2

Read the extracted fields

The tool shows key parts like hostname and pathname. Copy any field with the copy buttons.

3

Check query parameters

Below “Params”, you get the query key/value pairs. This is the fastest way to spot a missing parameter or a typo.

How to interpret results

  • If port\texttt{port} is empty, the URL is using the default port for the protocol.
  • search\texttt{search} includes the leading ?\texttt{?}.
  • If you see username\texttt{username} and password\texttt{password}, treat it as sensitive.

Worked example (step-by-step)

Input:https://me:[email protected]:3000/url-parser?key1=value&key2=value2#the-hash

protocol\text{protocol}==https:\texttt{https:},,hostname\text{hostname}==calculatorvast.com\texttt{calculatorvast.com}
username\text{username}==me\texttt{me},,password\text{password}==pwd\texttt{pwd},,port\text{port}==3000\texttt{3000}
pathname\text{pathname}==/url-parser\texttt{/url-parser},,search\text{search}==?key1=value&key2=value2\texttt{?key1=value\&key2=value2}

Interpretation: now you can quickly confirm the endpoint calculatorvast.com:3000\texttt{calculatorvast.com:3000} and verify your query keys key1\texttt{key1} and key2\texttt{key2}.

Real-world examples / use cases

Debugging a broken redirect

Background: a link works locally but fails in staging.
Input:https://staging.example.com:8443/callback?code=abc123&state=xyz
Result: check port=8443\texttt{port=8443} and verify the query keys code\texttt{code} and state\texttt{state} exist.

Spotting credentials in URLs

Background: you’re reviewing logs and want to ensure secrets are not embedded in links.
Input:https://user:[email protected]/api/v1/data
Result: the parser exposes username\texttt{username} and password\texttt{password} immediately.

Verifying API base URL + path

Background: your client builds URLs dynamically.
Input:https://api.example.com/v2/users/42
Result: confirm hostname=api.example.com\texttt{hostname=api.example.com} and pathname=/v2/users/42\texttt{pathname=/v2/users/42}.

Checking query encoding

Background: a query value contains spaces or special characters.
Input:https://example.com/search?q=hello%20world&lang=en
Result: use the parser to confirm the query keys, then use URL encoder/decoder to encode new values safely.

Common scenarios / when to use

Client-side URL building

Useful when template strings produce double slashes or missing segments in pathname\texttt{pathname}.

Deep links with fragments

Great for validating links that rely on \texttt{#fragment} navigation.

Auth callbacks

Confirm the presence (and spelling) of keys like code\texttt{code} and state\texttt{state}.

Privacy checks

Catch unexpected credentials or tokens in URLs before sharing screenshots or logs.

Query-heavy dashboards

Useful when analytics tools add many query keys and you need to isolate the important ones.

Reverse proxy configs

Verify whether the upstream should include port\texttt{port} and the exact pathname\texttt{pathname}.

When this may not apply: if you’re parsing non-standard strings (custom schemes, partial URLs, or legacy formats), you may need domain-specific parsing rules.

Tips & best practices

Fast sanity checks

  • Always confirm hostname\texttt{hostname} first; it’s the most common “looks right” bug.
  • If a request reaches the wrong service, check port\texttt{port} and the first path segment.
  • For query debugging, copy the full search\texttt{search} string and paste into a diff tool.

Avoid common mistakes

  • Don’t share URLs that include username:password@\texttt{username:password@}.
  • Don’t manually “fix” spaces—use a proper encoder (see URL encoder/decoder).
  • Duplicate query keys exist in the real world; this tool keeps the last value per key.

Calculation method / formula explanation

This tool follows the standard URL structure used by modern browsers. Think of a URL as a template that can include optional pieces.

\texttt{URL = scheme://[username:password@]host[:port]/path?query#fragment}

Square brackets mean “optional”.

In the browser, parsing is effectively:parts = new URL(input)\texttt{parts = new\ URL(input)}. If parsing fails, the tool marks the URL as invalid.

protocol\text{protocol}==https:\texttt{https:},,pathname\text{pathname}==/api/v1/items\texttt{/api/v1/items},,search\text{search}==?q=abc\texttt{?q=abc}

Variables / fields (what they mean):

  • protocol\texttt{protocol}: scheme + colon, for example https:\texttt{https:}.
  • hostname\texttt{hostname}: domain or IP.
  • pathname\texttt{pathname}: the path portion, starting with /\texttt{/}.
  • search\texttt{search}: the raw query string, including the leading ?\texttt{?}.

Related concepts / background info

Absolute vs relative URLs

This parser expects a fully-qualified URL. A string like /docs?page=2\texttt{/docs?page=2}is “relative” and may need a base URL before parsing.

Query strings

The query string begins with ?\texttt{?} and uses \texttt{&} to separate key/value pairs.

Security note

Credentials in URLs can leak through browser history, logs, referrers, and analytics. Prefer headers or secure token storage.

Frequently asked questions (FAQs)

Why does the protocol include a colon?

Browsers represent it as https:\texttt{https:} (including the colon) to match the URL specification.

Why is the port empty?

If you don’t explicitly specify a port, the URL uses the default (for example, 443443 forhttps:\texttt{https:}).

Can a URL have duplicate query keys?

Yes. This tool displays query parameters as key/value pairs, and keeps the last value per key when building the list.

Why can’t I parse a relative URL like /path?x=1?

Relative URLs need a base to become absolute. Convert to an absolute URL first (for example,https://example.com/path?x=1).

How do I encode a query value safely?

Use a proper encoder to avoid breaking the query string. Try our URL encoder/decoder tool.

Does this tool send my URL to a server?

No. Parsing happens locally in your browser.

Limitations / disclaimers

This tool is for inspection and debugging. It should not be treated as a security scanner, and it does not validate whether a hostname is reachable or safe.

External references / sources

Next step

If you’re fixing encoding issues, jump to URL encoder/decoder. If you’re comparing URLs, copy the parts you care about and paste them into a diff tool.

URL parser | CalculatorVast