Skip to content

URL Parser

Decompose any URL into components and query parameters. Encode or decode URL components safely.

How it works

The parser feeds your input to the browser's own URL constructor — the same WHATWG-compliant engine that resolves every link you click. That matters because URL parsing is full of normalization rules: default ports disappear, .. segments collapse, non-ASCII hosts become punycode, and stray characters get percent-encoded. Seeing the normalized result is often the whole point of debugging a URL.

Every component is shown separately: href, origin, protocol, credentials, hostname, port, pathname, query string and fragment. The query parameters are exploded into a key-value table, so a wall of &-separated text becomes something you can actually read and diff against expectations.

The component encoder handles encodeURIComponent and its reverse. This is the function you want for a single query value — not encodeURI, which deliberately leaves ? & = # intact because it is designed for whole URLs. Using the wrong one is one of the most common causes of double-encoded or corrupted parameters.

Everything runs locally with the platform URL API. URLs routinely contain tokens, session IDs and internal hostnames, so nothing you paste is transmitted anywhere.

Worked example

Parse https://user:pass@sub.example.com:8443/path/to/page?q=dev&lang=en#section-2. The engine separates eleven components and two query parameters.

ComponentValueNote
originhttps://sub.example.com:8443Scheme + host + port; the security boundary browsers enforce.
pathname/path/to/pageThe resource path, kept as-is.
search?q=dev&lang=enRaw query string; the table below decodes each pair.
hash#section-2Fragment — never sent to the server.
  1. Paste the URL: Include the scheme — https:// is required for absolute parsing.
  2. Read the components: Origin, host, port, path, query and fragment are listed separately.
  3. Inspect the parameters: The query string is exploded into a decoded key-value table.
  4. Encode what you need: Use the component encoder for individual values, then copy the JSON export if useful.

The parameter table splits the query into q=dev and lang=en. Note that the credentials (user:pass) are parsed too — a reminder that URLs with embedded passwords leak easily into logs and should never be used for real secrets.

Common errors and edge cases

  • Relative URLs fail. example.com/page without a scheme is not parseable on its own. Add https:// or provide a base URL in code.
  • encodeURI vs encodeURIComponent. The first preserves URL syntax characters and is for complete URLs; the second escapes them and is for individual values. Mixing them up corrupts queries.
  • Double encoding. A value showing %2520 was encoded twice (%25 is the percent sign itself). Decode once and re-encode correctly.
  • The + sign trap. In query strings + historically means space, but decodeURIComponent does not convert it. Form-encoded data needs application/x-www-form-urlencoded handling.
  • Fragments never reach the server. Anything after # stays in the browser, so analytics and logs never see it.

Code equivalents

The URL API exists in every modern runtime. These snippets reproduce exactly what the tool shows.

LanguageExample
JavaScriptconst u = new URL(input); u.searchParams.get('q') reads one parameter; [...u.searchParams] lists them all.
Python 3urllib.parse.urlparse(input) splits components; urllib.parse.parse_qsl(u.query) decodes the query.
Node.jsnew URL(input) — the same WHATWG API as the browser, no dependency needed.

Frequently asked questions

Why does my URL fail to parse?

The URL API requires a scheme. example.com/path alone is treated as relative and rejected — add https:// (or http://) and it parses normally.

What is the difference between host and hostname?

host includes the port (example.com:8443), hostname does not. When the port is the scheme default, both collapse to the bare domain.

Should I use encodeURI or encodeURIComponent?

encodeURIComponent for a single query value or path segment, because it escapes &, =, ? and #. encodeURI is only for a complete URL you want to keep structurally intact.

Why is + not decoded as a space?

decodeURIComponent follows the URI standard, where + is literal. The space-means-plus rule belongs to HTML form encoding; handle it with a form parser or a replace before decoding.

Is it safe to paste URLs with tokens here?

Yes for parsing: everything runs in your browser and nothing is transmitted. Still avoid sharing parsed output that contains live session tokens or credentials.

Privacy note

All processing happens in your browser. The values you enter never leave your device and are never transmitted to ToolPlex.