Open a search results page, a filtered shop listing or a campaign link and look at the address bar. After the tidy part of the address there is usually a question mark, and after that a tail of short codes joined by symbols: something like ?q=red+shoes&page=2. That tail is not decoration and it is not random. It is data, packed into the link itself, and the page at the other end unpacks it to decide what to show you.
That tail is called a query string. The Query String Builder assembles one from a table of names and values.
Contents
- Quick answer
- The definition, piece by piece
- How a query string works when a page receives it
- Encoding: how values survive the trip
- Why the order of parameters almost never matters
- The edges of the format: empty values and nameless rows
- How to build a query string, step by step
- Worked example: taking a search URL apart
- Limitations and honest tradeoffs
- Common mistakes
- FAQs
- Conclusion
Quick answer
A query string is the part of a URL after the question mark, made of name=value pairs joined by ampersands. It carries search terms, page numbers, tracking codes and similar data to the page that receives the link, and the receiving site reads the pairs by name. When you build one, encoding matters: with encoding on, spaces become + and characters like & and # inside values are escaped, so the values arrive intact. The Query String Builder assembles all of this from a table, so the structure is correct by construction.
The definition, piece by piece
Take the definition apart and every word earns its place. The question mark is the divider: everything before it identifies the page, everything after it is the query string. Inside the query string, data travels as pairs in the form name=value: the name says what the data is, the value says what it is set to. Pairs are joined by ampersands, so a string with two pairs reads q=red+shoes&page=2: a parameter named q with the value red shoes, and a parameter named page with the value 2.
What kind of data rides in these pairs? The usual cargo: search terms, page numbers, tracking codes and similar data. A search page needs to know what you searched for. A listing split across pages needs to know which page you are on. A campaign link needs to carry the code that tells the site's analytics where the visit came from. The link itself is the envelope, and the query string is the note inside it.
How a query string works when a page receives it
When a browser requests a URL, the whole address travels, query string included. The receiving site reads the pairs and uses them to shape its response: it runs the search in q, serves page 2 because page says so, or records the tracking code against the visit. That is why the same page can appear under hundreds of different URLs: the part before the question mark stays constant while the string varies, and each variation asks for a slightly different view. It is also why a mistyped character fails silently: the page still loads, but it reads a different instruction than the one you meant to send.
Encoding: how values survive the trip
A value like red shoes contains a space, and a raw space cannot travel inside a URL. Encoding is the set of substitutions that makes values safe to send. With encoding on in the Query String Builder, spaces in values become +, and characters like & and # are escaped, which is the standard behavior for query strings. The & case shows why: an ampersand is the joiner between pairs, so an unescaped one inside a value would be read as the start of a new parameter, cutting the value in half. Escaping marks it as data, not structure.
Why the order of parameters almost never matters
It is natural to assume the pairs form a sequence the site reads from left to right, like words in a sentence. They do not. For almost all websites, parameters are read by name: the site looks up page by its name and takes whatever value follows it, wherever in the string it sits. ?page=2&q=red+shoes and ?q=red+shoes&page=2 ask for the same thing.
The builder keeps your row order anyway, as a readability aid rather than a technical need: a stable order helps when you compare two links side by side.
The edges of the format: empty values and nameless rows
Two edge cases define where the format ends. A parameter can have an empty value: give the row a name and leave the value blank, and the URL gets name= with nothing after the equals sign. The parameter is present, named, and deliberately empty.
The reverse is not possible. A row with a value but no name is rejected, because it cannot be represented. A pair is a name with a value attached; a nameless value has nothing for the receiving site to look up.
How to build a query string, step by step
- Open the Query String Builder and enter the base URL, with or without parameters it already has.
- Add one row per parameter: a name on the left, its value on the right.
- Leave encoding on unless you have a specific reason to place values exactly as typed.
- Copy the finished URL from the result box and use it where the link needs to go.
One behavior is worth knowing first: parameters already on the base URL are kept, and new rows are appended after them.
Worked example: taking a search URL apart
Start with the base URL https://example.com/search and two rows in the builder: q set to red shoes, and page set to 2. The finished URL is:
https://example.com/search?q=red+shoes&page=2
Read it piece by piece. The part before the question mark is the page, a search page on example.com. The question mark opens the query string. The first pair, q=red+shoes, is the search term: the name q, and the value red shoes with its space encoded as +. The ampersand joins the pairs. The second pair, page=2, is the page number. The receiving site reads both by name and returns page 2 of the results for red shoes.
Limitations and honest tradeoffs
A query string carries data in the open. Anything in it is visible in the address bar, in browser history and in server logs, so it is the wrong place for anything private. It is also a convention, not a contract: the receiving site decides which parameter names it understands, and a perfectly built string with a name the site does not read will simply be ignored. And while this builder is general purpose, campaign links have a specialist: the UTM Builder in Marketing Tools, built around the five standard campaign parameters with source and medium picklists.
Common mistakes
- Typing separators by hand. A missing or doubled
?or&changes what the string says, and the page fails silently instead of complaining. - Turning encoding off without a reason. Values go in exactly as typed, and an
&inside a value becomes a new parameter at the receiving site. - Expecting order to change behavior. Sites read parameters by name. Reordering pairs does not send a different instruction.
- Writing a value with no name. It cannot be represented, and the builder rejects the row.
- Putting private data in a link. Query strings are visible wherever URLs are stored or shown.
FAQs
What is a query string? It is the part of a URL after the question mark, made of name=value pairs joined by ampersands. It carries search terms, page numbers, tracking codes and similar data from the link to the page that receives it.
What does encoding do to a parameter value? With encoding on, spaces in values become + and characters like & and # are escaped, which is the standard behavior for query strings. That escaping is what stops a character inside a value from being mistaken for part of the URL's structure.
Can a parameter have an empty value? Yes. Give the row a name and leave the value blank, and the URL gets name= with nothing after the equals sign. A row with a value but no name is rejected, because it cannot be represented.
Does the order of parameters in a query string matter? For almost all websites, no. Parameters are read by name, so the receiving site finds each value by looking up its name rather than its position. Keeping a consistent order still helps when you compare two links side by side.
How is the Query String Builder different from the UTM Builder? The Query String Builder handles any parameters for any purpose. The UTM Builder in Marketing Tools is specialized for the five standard campaign parameters, with source and medium picklists.
Conclusion
A query string is a small, strict format: a question mark, then name and value pairs joined by ampersands, with encoding keeping the values intact on the trip. Once you see the structure, the long addresses in a browser stop looking like noise and start reading as instructions you can inspect and rebuild. When you need to build one rather than just read one, the companion guide on building a URL with multiple parameters correctly walks through the failure points one by one. For more guides in this series, see the URL and Link Tools guides.