Utilumo
LightDarkSystem
Guide1 min readUpdated June 29, 2026

How to build a query string

Short answer

A query string is the part of a URL after the question mark, made of key=value pairs joined by ampersands. Build it by pairing each key with its value, encoding anything unsafe, and separating pairs with &.

The shape of a query string

Everything after the ? is the query string. Each parameter is a key=value pair, and & separates them. The page or server reads these pairs to receive options like a search term, a page number, or a filter.

?q=fish&page=2
Two parameters

Encode the values

Values can contain characters that have meaning in a URL, like spaces, &, or =. Those must be percent-encoded so they are read as data, not structure. See What is URL encoding?.

Try it: Query Param BuilderAdd key/value pairs and get a correctly encoded query string locally.Open tool

Repeated keys and order

  • Repeating a key, like tag=a&tag=b, is the usual way to pass a list
  • Order is generally preserved but should not be relied on for meaning
  • Empty values are allowed, as in q=
Not all parameters are trackingFunctional parameters such as a search term differ from tracking tags. To strip only the trackers, see How to remove tracking parameters from URLs.

References

Questions

How do I pass a list of values in a query string?

Repeat the key, for example tag=a&tag=b&tag=c. Most servers and the browser's URLSearchParams read repeated keys as a list.

Do I need to encode every value?

Encode any value that could contain spaces, &, =, or other reserved characters. Plain letters and digits do not need encoding, but encoding them is harmless.

Does the query builder upload anything?

No. The query string is assembled locally in your browser and nothing is uploaded.

Keep reading