A query string looks harmless: a question mark, a few names and values, some ampersands. Then a link gets shared, the search page loads with the wrong term, or a report shows a parameter nobody remembers creating. In most of those cases the URL was not wrong in an exotic way. It was broken by one of two small characters: a space that was never encoded, or an ampersand that landed inside a value and split it in two.
This guide walks through both mistakes, plus three more that come from the same mechanics, using the free Query String Builder on Ovatly, which assembles URLs from a table of names and values instead of asking you to type the punctuation by hand.
Contents
- Quick answer
- What encoding does to a value
- Mistake one: the unencoded space
- Mistake two: the ampersand inside a value
- Three more mistakes from the same mechanics
- How to build a query string, step by step
- Worked example: one row, right and wrong
- Limitations and honest tradeoffs
- Common mistakes
- FAQs
- Conclusion
Quick answer
Leave encoding on. With encoding on, the Query String Builder turns a space in a value into + and escapes characters like & and #, which is the standard behavior for query strings, so each value arrives at the receiving site as one piece. With encoding off, values go in exactly as typed, and an ampersand inside a value is read by the receiving site as the start of a new parameter. One value silently becomes two parameters, which is occasionally what testers want and usually a mistake.
What encoding does to a value
A query string is the part of a URL after the question mark: name and value pairs joined by ampersands, like q=red+shoes&page=2. The receiving site reads those pairs by name, which is why the order of the pairs almost never matters. For that reading to work, the punctuation inside a value has to be distinguishable from the punctuation that separates the pairs. Encoding is what draws that line. A space becomes +. An ampersand or a hash inside a value is escaped, so the site treats it as data rather than structure. Skip the encoding, and the structure characters inside your values start doing structural jobs.
Mistake one: the unencoded space
A space is not a clean, unambiguous character inside a URL value. Type q=red shoes by hand and different tools along the way will handle that space differently: some encode it, some pass it through, some truncate the value at it. The search term that arrives may be just red, or the full term, or something with an encoding you did not choose. With encoding on, the builder removes the guesswork: the space becomes +, the standard form in a query string, and the value arrives as the single term you typed. The mistake is rarely visible in the address bar, which is exactly why it survives: the link looks fine and quietly searches for the wrong thing.
Mistake two: the ampersand inside a value
The ampersand is the separator between pairs, so it is the most dangerous character to leave raw inside a value. Suppose a value is fish & chips and encoding is off, so the value goes in exactly as typed. The receiving site does not see one value with an ampersand in it. It sees the pair end at the ampersand and a new parameter begin after it. One value has silently become two parameters, and the second one has a name nobody chose. With encoding on, the ampersand is escaped and stays inside the value where it belongs. Turning encoding off does have a legitimate use: testers sometimes want a value placed exactly as typed, to see how a site reacts. Outside that deliberate test, it is the most reliable way to break a query string.
Three more mistakes from the same mechanics
The unescaped hash. The # character starts the fragment, the part of the URL that comes after the pairs. A raw # inside a value ends the query string early: everything after it is treated as a fragment and never reaches the server as parameters. Encoding escapes it for the same reason it escapes the ampersand.
The nameless row. A parameter needs a name. A row with a value but no name cannot be represented, so the builder rejects it rather than guessing. An empty value, by contrast, is fine: a name with nothing after the equals sign produces name= in the URL.
Overwriting the base URL's parameters. Hand-typing a fresh question mark can wipe out parameters the base URL already carried. The builder keeps the parameters already on the base URL and appends new rows after them, so adding a parameter never deletes the ones that were already working.
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. Existing parameters are kept.
- Add one row per parameter: the name on the left, its value on the right. A value can be left empty, but every row needs a name.
- Leave encoding on, unless you have a specific reason to place a value exactly as typed.
- Copy the finished URL from the result box and check the values: spaces should read as
+, and no raw&should appear inside a value.
Worked example: one row, right and wrong
Take the builder's own example. The base is https://example.com/search, and the rows are q = red shoes and page = 2. With encoding on, the result is https://example.com/search?q=red+shoes&page=2: the space in the search term became +, and the single ampersand sits between the two pairs, doing its one proper job.
Now break it piece by piece. Type the space raw, and the term may arrive truncated or inconsistently encoded, depending on what handles the link next. Then imagine the term were red & blue shoes with encoding off: the receiving site reads q=red, then a stray parameter it was never meant to see, then page=2, and the search quietly runs on the wrong words. The same link to look at, three different requests.
Limitations and honest tradeoffs
The builder assembles the URL you describe; it does not visit the receiving site, so it cannot tell you whether that site accepts a parameter, ignores it, or expects a different name. Parameter names and expected values belong to the site on the other end. Encoding here follows the standard query string behavior, which is what almost every site expects, but a specific system can have its own conventions. And a correctly encoded URL can still be the wrong URL: encoding guarantees the values arrive intact, not that they were the right values.
Common mistakes
- Turning encoding off without a testing reason. Values go in exactly as typed, ampersands included, and the receiving site splits them into extra parameters.
- Leaving a space raw in a value and trusting the address bar. The link can look right and still deliver a truncated term.
- Adding a row with a value and no name. It cannot be represented and is rejected; give every row a name, even when the value is empty.
- Rebuilding a URL from scratch and dropping the parameters the base already had. The ones you forgot are usually the tracking or session values someone else needed.
FAQs
What happens if a value contains an ampersand? It depends on encoding. With encoding on, the ampersand is escaped and stays part of the value. With encoding off, the value goes in exactly as typed, and the receiving site reads the ampersand as the start of a new parameter, so one value silently becomes two parameters.
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 matter? For almost all websites, no. Parameters are read by name, so the pairs can appear in any order and the site finds the ones it expects. The builder keeps the order of your rows anyway.
Why did my rebuilt URL lose the parameters it already had? Hand-typing a new question mark often replaces what was there. The builder keeps the parameters already on the base URL and appends new rows after them, so adding a parameter does not delete the existing ones.
Should encoding ever be turned off? Only with a specific reason, such as a tester wanting a value placed exactly as typed to see how a site reacts. For ordinary links, encoding off is how raw spaces and ampersands get into values, and it is usually a mistake.
Conclusion
Both title mistakes are the same mistake underneath: structure characters doing data jobs. Encoding is the line between the two, and the Query String Builder draws it for you when you build from a table instead of typing punctuation by hand. If you are still deciding where a piece of data belongs in the address at all, our comparison of query strings vs path parameters covers that choice. For more guides in this series, see the URL and Link Tools guides.