%url-decoder.net

Query Strings Explained: Keys, Values and Parser Differences

Updated November 18, 2026 · 6 min read

Short answer

A query string is the part of a URL after ?, made of key=value pairs joined by &. Values are percent-encoded, and in most query strings + means a space. The same key may appear more than once, and parsers differ on repeated, empty and valueless keys, so read them with a proper parser instead of splitting by hand.

Query strings carry search terms, filters, page numbers and tracking tags in almost every URL you see. Their format looks simple, but several of its corners behave differently from one parser to the next. Every example below was produced by running the code.

The anatomy

Everything after the first ? and before any # is the query. By convention it is a list of key=value pairs joined by &. Characters that have a job in this syntax, such as &, = and #, must be percent-encoded when they are part of a value.

How a parser reads it

Here is q=caf%C3%A9+au+lait&tag=a&tag=b&page=&debug parsed with JavaScript's URLSearchParams:

KeyValue
qcafé au lait
taga
tagb
page(empty string)
debug(empty string)
  • + became a space, because query strings follow form-encoding rules.
  • tag appears twice: getAll("tag") returns ["a","b"], while get("tag") returns only "a".
  • page= and a bare debug both come back as empty strings.

Parsers disagree

  • Python's parse_qs drops empty values by default. On a=1&a=2&b= it returns {'a': ['1', '2']}, with no b. Pass keep_blank_values=True to keep it.
  • Array syntax is a convention, not a standard. tag[]=a&tag[]=b is read by URLSearchParams as two keys literally named tag[]. Frameworks such as PHP turn it into an array; others do not.
  • Repeated keys are kept as a list by some frameworks, while others keep only the first or the last value.

Building one safely

Do not join strings by hand. Let a builder encode each value:

new URLSearchParams({ q: "Tom & Jerry", page: "2" }).toString()
// "q=Tom+%26+Jerry&page=2"

The ampersand inside the value became %26 and the spaces became +. If the receiver expects %20 rather than +, encode each value with encodeURIComponent instead; the function comparison shows how each language differs.

Length

The URL standard sets no maximum. RFC 9110 recommends that senders and recipients support URIs of at least 8000 octets, but browsers, servers and proxies apply their own limits, and a server may answer 414 URI Too Long. Send large data in the request body.

To inspect or edit a real query string, paste it into the Query String Parser, which lists every pair, keeps duplicates, and copies the result back as a string or as JSON.

Questions

What is a query string?

The part of a URL after the question mark and before any #. It usually holds key=value pairs separated by & that the server or page reads as parameters, such as search terms or filters.

Can a query parameter appear more than once?

Yes. tag=a&tag=b is valid. URLSearchParams returns both with getAll('tag'), and Python's parse_qs returns a list. Whether a server keeps the first, the last or all values depends on the framework.

Are query strings case-sensitive?

The keys and values are passed to the server exactly as written, so they are case-sensitive unless the application chooses otherwise.

How long can a query string be?

There is no limit in the URL standard. RFC 9110 recommends supporting URIs of at least 8000 octets, but browsers, servers and proxies set their own limits, so put large data in the request body.

See also

Try everything in this guide hands-on, free and entirely in your browser.

Open the Query String Parser

Keep reading