# URL query parse

`url-query-parse` · version 1.0.0 · URLs & IP addresses · free, no key needed

Parse query pairs and fragment from an absolute URL. Parse only; no fetching.

**Use when you need to: url query parse · parse query string · parse url search params.**

## Supported

- url query parse
- parse query string
- parse url search params

## Not supported

- fetch
- decode html
- relative urls without base

## Behavior

- url must be an absolute URL accepted by the WHATWG URL constructor. Relative URLs are invalid_input.
- Do not fetch, DNS, or open sockets. new URL is parse-only.
- pairs are the ordered application/x-www-form-urlencoded list from url.searchParams (duplicates preserved, + as space).
- fragment is url.hash without a leading #; empty string if none.
- Max 512 pairs. Reject over-long url bytes.

## Input

- `url` (string, required): min length 1; max length 8192

## Output

- `pairs` (array of object, required): max items 512
- `fragment` (string, required)

## Limits

- max url bytes: 8192
- max query pairs: 512

## Example

Request input:

```json
{
  "url": "https://example.com/p?a=1&a=2&b=x+y#z"
}
```

Response:

```json
{
  "result": {
    "pairs": [
      {
        "name": "a",
        "value": "1"
      },
      {
        "name": "a",
        "value": "2"
      },
      {
        "name": "b",
        "value": "x y"
      }
    ],
    "fragment": "z"
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "url-query-parse",
  "version": "1.0.0",
  "input": {
    "url": "https://example.com/p?a=1&a=2&b=x+y#z"
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/url-query-parse/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/p?a=1&a=2&b=x+y#z"}'
```

The machine-readable contract is at [/v1/tools/url-query-parse/versions/1.0.0](/v1/tools/url-query-parse/versions/1.0.0).

### CLI

```sh
node cli.mjs run url-query-parse 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [URL query build](/tools/url-query-build): Build a query string or replace an absolute URL query from ordered pairs. No fetching.
- [URL query merge](/tools/url-query-merge): Merge query pairs into an absolute URL. No fetching.
- [IPv4 CIDR parse](/tools/ipv4-cidr-parse): Parse an IPv4 CIDR block into its network, broadcast, netmask, wildcard mask, usable host range and address counts.
- [IPv4 parse](/tools/ipv4-parse): Parse a canonical dotted-decimal IPv4 address into octets and a uint32 integer string.
- [IPv6 CIDR parse](/tools/ipv6-cidr-parse): Parse an IPv6 CIDR block into its canonical network address, prefix, first/last address, and total address count.
- [IPv6 parse](/tools/ipv6-parse): Parse an IPv6 address (any RFC 4291 textual form) into its 8 hextets and a 128-bit integer string.
