URL Pathname

Extract the pathname of an absolute URL using the WHATWG URL parser, including its normalization rules.

Description

The pathname is the URL's path component, separate from query and fragment.

The pathname is the URL's path component, separate from query and fragment. Hierarchical paths and opaque paths, such as mailto content, have different structures.1

Extract the pathname of an absolute URL using the WHATWG URL parser, including its normalization rules.

When to use URL Pathname

Use this tool to extract the pathname of an absolute URL using the WHATWG URL parser, including its normalization rules.

Choose the URL, decoded source text, header value or explicit byte list requested by this tool. Paste the complete relevant input and follow its parsing and encoding conventions.

How to use URL Pathname and understand its results

  1. Choose the URL, decoded source text, header value or explicit byte list requested by this tool. Paste the complete relevant input and follow its parsing and encoding conventions.
  2. Enter url using the field table and calculation rules, then run the tool.
  3. Read pathname. The explanation below defines the units, signs, ordering and any flags or placeholder values.
  4. If the tool reports an input issue, correct the values and run it again. Apply the stated assumptions when interpreting a successfully returned result.
Input fieldMeaningValue type; see rules belowRequirement
urlAbsolute URL to parse.string; maximum length: 1000000Required

Paste an absolute URL. The tool returns the parser's normalized pathname, including hierarchical leading slashes and retained percent escapes. Dot segments are normalized where the URL scheme's parsing rules apply.

pathname=WHATWG_URL(url).pathname

Units, indexing, boundary conditions and exceptional cases are defined in the calculation rules above.

Output fieldMeaningValue type
pathnameNormalized URL pathname.string; maximum length: 1000000
json
{
  "input": {
    "url": "https://reader:secret@EXAMPLE.com:8443/a/../guide?q=one&q=two#part"
  },
  "output": {
    "pathname": "/guide"
  }
}

Limitations and assumptions

This does not percent-decode a filesystem path, inspect a server route or reject every opaque scheme. Use the segment tool when a hierarchical slash-delimited path is needed.

Numeric inputs must be finite. Follow the calculation-specific rules for overflow, underflow and exceptional cases. Extremely large text inputs are rejected. Missing required fields, extra fields, wrong value types and violations of the calculation rules are input errors.

Alternative or Complementary methods

Use URL Path Segments: Split a hierarchical absolute URL path into percent-encoded segments while preserving empty interior and trailing segments. For a complementary task, use URL Search: Extract the search of an absolute URL using the WHATWG URL parser, including its normalization rules.

References

  1. URL Pathname — tool.io

Similar or alternative tools

  • URL Path Segments

    Split a hierarchical absolute URL path into percent-encoded segments while preserving empty interior and trailing segments.

  • URL Search

    Extract the search of an absolute URL using the WHATWG URL parser, including its normalization rules.

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies