An ampersand breaks a query string when it appears inside a value without being encoded. In query syntax, & separates parameters, so a literal ampersand inside a search term, company name, or tracking value must be written as %26.
When building links, encode the value with the URL Encode tool. When debugging a messy tracking link, inspect it with the URL Decode tool.
Why does an ampersand break my query string?
An ampersand breaks a query string because parsers treat & as the boundary between parameters. If the intended value is Jack & Jill but the ampersand is not encoded, the server may read Jack as one value and Jill as a new parameter.
How do I put & inside a query parameter?
Put & inside a query parameter by encoding it as %26. For example, q=Jack%20%26%20Jill keeps the ampersand inside the q value instead of turning it into a separator between query parameters.
Why does an equals sign cause problems?
An equals sign causes problems because it separates a parameter name from its value. If an equals sign is part of the value, encode it as %3D; otherwise a parser or log viewer may make the value look like another key-value pair.
What about question marks inside a value?
A question mark inside a value should be encoded as %3F. The first real ? in a URL starts the query string. Any question mark that is part of data, such as a search phrase or redirect URL, should not appear raw inside a parameter value.
Can I encode only the dangerous characters?
You can encode only dangerous characters, but it is safer to encode the entire value as a component. Component encoding handles spaces, Unicode, percent signs, ampersands, equals signs, and question marks consistently without requiring a manual checklist.
How do I debug a broken query string?
First split the URL at the real ?, then inspect each parameter. If a value visibly contains raw &, =, or #, it was probably not encoded. Paste the encoded value into the URL Decode tool to confirm the intended text.
What is the practical fix?
The practical fix is to encode every user-supplied parameter value before building the URL. Use the URL Encode tool for manual links, or encodeURIComponent, URLSearchParams, or your framework's URL builder in code.