Skip to content
ToolkitHub

URL Parser / URL Breaker

Parse and break down URLs

Guide

The anatomy of a URL

By Logappradeep · ServiceNow developer

A URL packs a lot into one line: which protocol to use, which server to contact, which resource to request, extra parameters and a position within the page. When you are debugging a redirect, an OAuth callback, a tracking link or a broken API call, seeing those parts separately saves time. This tool splits a URL into its components as you type.

The components

Consider https://shop.example.com:8080/products/shoes?color=red&size=10#reviews:

  • Protocol https: is the scheme, including its trailing colon.
  • Host shop.example.com:8080 is the hostname plus the port.
  • Port 8080. When a URL uses the scheme's default port (443 for HTTPS, 80 for HTTP), it is reported as empty, shown here as "(default)".
  • Path /products/shoes identifies the resource on the server.
  • Query ?color=red&size=10 carries key-value parameters, listed in their own table.
  • Hash #reviews is the fragment, a position or state within the page.
  • Origin https://shop.example.com:8080 combines scheme, host and port. Browsers use the origin for security decisions such as CORS and cookie isolation.

How the parser works

The tool uses the browser's built-in URL class, which implements the WHATWG URL Standard, the same rules browsers use when you click a link. Query parameters are read with URLSearchParams, which decodes percent-escapes like %20. If the input cannot be parsed as an absolute URL, you will see an "Invalid URL" message. Everything happens locally; the URL is not requested or sent anywhere.

Practical uses

  • Reading the parameters of a long marketing link with UTM tags.
  • Checking the redirect_uri or state in an OAuth or SSO callback.
  • Verifying that a signed or pre-authenticated URL contains the expected fields.
  • Comparing the origin of two URLs when debugging CORS errors.

Pitfalls

The fragment never reaches the server. Browsers strip everything after # before sending a request, so server-side code cannot read it. Single-page apps and OAuth implicit flows use it precisely for that reason.

Plus signs in queries. In the query string, + is decoded as a space, but in the path it stays a literal plus. Encode a real plus in a parameter as %2B.

Repeated keys. A query such as ?tag=a&tag=b is legal and many frameworks read it as a list. The parameter table here shows one row per key with the last value, so check the raw query when keys repeat.

Relative URLs and missing schemes. /path?x=1 or example.com on their own are not absolute URLs and will not parse; include the scheme.

Internationalized domains. Hostnames with non-ASCII characters are converted to their Punycode form beginning with xn--, which is the form DNS actually uses.

Frequently asked questions

Why is the port shown as default?

When a URL uses the standard port for its scheme, such as 443 for HTTPS, the URL standard reports the port as empty. The connection still uses that default port.

Does the server receive the part after #?

No. Browsers keep the fragment on the client and never send it in the HTTP request.

Why do plus signs turn into spaces?

In query strings, the form-encoding rules treat + as a space. Use %2B when you need a literal plus sign in a parameter value.

Why does my URL show as invalid?

The parser needs an absolute URL with a scheme, such as https://example.com/path. Bare hostnames and relative paths are rejected.