Home / Encoders & Decoders

URL Parser

Runs locally in your browser. Your input is not uploaded.

Components
Query parameters (decoded)
KeyValue

A URL parser separates an address into the fields that browsers and web APIs use: scheme, credentials, host, port, path, query, and fragment. Use this tool to inspect a redirect target, debug an API request, or see how encoded query values are interpreted without sending the URL to a parsing service.

The parser uses the browser's built-in URL implementation. It displays the normalized URL components, decodes path segments for readability, lists query parameters in order, and prepares a JSON representation for copying.

How to Use the URL Parser

Enter an address and review its parsed structure as the value changes.

  1. Paste or type an address in the URL field.
  2. Read the status below the field; an invalid value shows Not a valid URL.
  3. Review href, protocol, username, password, hostname, port, host, origin, pathname, search, hash, and segments under Components.
  4. Inspect each decoded Key and Value under Query parameters (decoded).
  5. Select Copy as JSON to copy the component fields and the structured query object.

How a URL Is Divided into Components

A typical absolute URL starts with a scheme such as https:, followed by an authority containing the hostname and an optional port. The path identifies a resource, the query carries parameters after ?, and the fragment follows #. A URL can also include a username and password before the host, although embedding credentials in addresses is risky and discouraged.

https://shop.example.com:8443/products/42?view=full#reviews

For this example, the hostname is shop.example.com, the port is 8443, and the host is the combination shop.example.com:8443. The pathname is /products/42; view=full belongs to the query, while reviews is the fragment. The origin combines the scheme, hostname, and effective port according to the browser's URL rules.

The href field is the browser's serialized form of the entire URL, so it may not be byte-for-byte identical to what you entered. The parser also splits the pathname on /, removes empty pieces, percent-decodes each remaining segment, and displays the result as a JSON array. It does not resolve a relative URL against the current ParseCode page.

Schemes, Normalization, and Missing URL Prefixes

The browser URL constructor initially expects an absolute URL. If that parse fails, this tool tries again after adding https://. A value such as example.com/docs therefore becomes an HTTPS URL, and the status says that no scheme was given and https:// was assumed.

That fallback is convenient for web addresses but is still an assumption. If the intended scheme is http:, ftp:, or another supported scheme, include it explicitly. Also check the parsed hostname and pathname instead of relying only on the input's visual appearance; punctuation in the wrong place can change which portion is treated as the authority.

Normalization is part of parsing. Default ports may serialize as an empty port, hostnames can be normalized, and percent-encoding may be preserved or adjusted in individual properties. If exact original bytes matter for signing, caching, or a forensic comparison, retain the source string alongside the parsed result.

Query Parameters, Repeated Keys, and Percent-Encoding

Query strings contain ordered name-value pairs. The Query parameters (decoded) table keeps each pair, including repeated names. Percent-encoded bytes are decoded, and a plus sign in form-style query data is interpreted as a space by URLSearchParams.

For example, ?tag=xml&tag=url&empty= produces two tag rows and one empty value. In the copied JSON, a name seen once becomes a string, while a repeated name becomes an array in encounter order. This is the tool's JSON representation, not a universal query-string data model; server frameworks may use different rules for duplicates or bracket notation such as filter[]=a.

Percent-decoding is context-sensitive. A slash encoded inside a path segment is decoded only in the displayed segments array, while pathname shows the URL property's serialized path. Query keys and values come from the browser's query parser. Use the URL encoder and decoder when you need to encode or decode a component directly.

Common Parsing Mistakes and Privacy Considerations

Do not confuse the fragment with a server request parameter. Browsers generally keep the #fragment client-side rather than including it in the HTTP request. Likewise, the parser only describes the address; it does not visit the URL, test whether the host exists, follow redirects, or verify that the destination is safe.

Be careful with credentials and secrets. This page processes the entered value locally in the browser and does not upload it for parsing, but the Components table and copied JSON expose any username, password, access token, or personal query value present in the URL. Redact sensitive values before sharing screenshots or JSON output.

Parsing is not a security allowlist. An address can be syntactically valid and still point to an untrusted host, use a deceptive hostname, or contain dangerous application parameters. Security-sensitive redirect and origin checks should compare normalized values under an explicit policy, usually including an allowed scheme, exact hostname, and permitted port. For token-shaped values, the JWT decoder can inspect their readable fields, but decoding does not establish trust.

Frequently Asked Questions

What happens if I enter a URL without https://?

If the browser cannot parse the original value as an absolute URL, the tool retries with https:// prepended. The status reports when this assumption was used. Include the scheme yourself when HTTPS is not the intended interpretation.

Why are hostname, host, and origin different?

Hostname contains the domain or IP address without a port. Host combines the hostname and explicit port, while origin represents the scheme and network authority in the browser's normalized form. These distinctions matter when comparing destinations or configuring same-origin rules.

How does the parser handle duplicate query parameters?

The decoded table shows every pair in its original order. In Copy as JSON output, the first value is initially a string and repeated values turn that property into an array. This representation does not interpret bracket syntax or infer data types.

Does the parser open or validate the destination?

No. It parses the text with the browser URL API but makes no request to the destination, checks no DNS record, and follows no redirect. A successful parse means the string has a URL structure, not that the resource exists or is trustworthy.

Is it safe to parse URLs containing passwords or tokens?

Parsing occurs locally, but the secret will be visible in the page and included in copied JSON. Prefer removing credentials, signature parameters, session identifiers, and personal data before using or sharing the result. Avoid putting long-lived secrets in URLs because URLs often reach histories, logs, and referrer data elsewhere.

References: WHATWG URL Standard · MDN: URL API.