URL Query Count

Count parsed query parameters in an absolute URL, including repeated names and empty values.

Description

A query is an ordered collection of name/value entries and may repeat a name.

A query is an ordered collection of name/value entries and may repeat a name. Counting entries differs from counting unique keys or nonempty values.1

Count parsed query parameters in an absolute URL, including repeated names and empty values.

When to use URL Query Count

Use this tool to count parsed query parameters in an absolute URL, including repeated names and empty values.

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 Query Count 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 count. 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.string; maximum length: 1000000Required

Paste an absolute URL. The WHATWG parser produces URLSearchParams and the tool returns its entry count. Repeated names and empty values each count; empty ampersand-separated pieces do not create entries. No query gives zero.

count=WHATWG_URL(url).searchParams.size

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

Output fieldMeaningValue type
countNumber of query parameters.integer; minimum: 0
json
{
  "input": {
    "url": "https://example.com/?tag=a&tag=b&empty="
  },
  "output": {
    "count": 3
  }
}

Limitations and assumptions

The count says nothing about application validity or accepted parameters. It neither fetches the URL nor deduplicates names; malformed and relative URLs are errors.

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 Search: Extract the search of an absolute URL using the WHATWG URL parser, including its normalization rules. For a complementary task, use Cache Bust Query Adder: Set one named cache-busting query parameter on an absolute URL while preserving other parameters and its fragment.

References

  1. URL Query Count — tool.io

Similar or alternative tools

  • URL Search

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

  • Cache Bust Query Adder

    Set one named cache-busting query parameter on an absolute URL while preserving other parameters and its fragment.

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