URL query parameters explained: what comes after the ?
How to read the part of a web address after the question mark: keys and values, ampersands, fragments, encoding and tracking tags, and what not to put in a URL.
Published
Tools for this job: URL Decoder · URL Encoder · UTM Link Builder
Web addresses often end in a long tail like ?q=red+shoes&size=8&sort=price#reviews. That tail is not random. It is a set of instructions to the page, and once you can read it, you can debug links, strip tracking and build URLs that work.
The parts of a URL
Take https://shop.example.com/search?q=red+shoes&size=8#reviews:
https: the protocol.shop.example.com: the host./search: the path, which page.?q=red+shoes&size=8: the query string, the parameters.#reviews: the fragment, a position or state within the page.
How parameters are written
- The query starts after the first
?. - Each parameter is a
key=valuepair. - Pairs are separated by
&. - Keys can repeat, such as
colour=red&colour=blue; how the site handles that is up to the site. - The order usually does not matter, though some systems treat different orders as different URLs.
Encoding: why you see %20 and +
Some characters have special meaning in URLs, and others, such as spaces and non-English letters, are not allowed as-is. They are percent-encoded: a space becomes %20, an ampersand inside a value becomes %26. In query strings submitted by forms, a space is often written as +. The guide to URL encoding covers the details.
Break a URL down
Paste any long address into the URL Decoder. It decodes the percent-encoding and breaks the address into protocol, host, path, each query parameter and the fragment. It can treat + as a space and unwrap addresses that were encoded more than once. To build a value safely, use the URL Encoder on that value only, not the whole URL.
The fragment stays in the browser
Everything after # is not sent to the server. It tells the browser where to scroll or, in web apps, which view to show. That is why changing only the fragment does not reload a page.
Tracking parameters
Many links carry parameters that only exist for analytics: utm_source, utm_campaign and click IDs added by ad and social platforms. They do not change the page. Removing them before sharing a link makes it shorter and stops passing on tracking information. To add your own campaign tags properly, use the UTM Link Builder; see UTM parameters explained.
Parameters and search engines
To a search engine, /shoes?sort=price and /shoes?sort=name are different URLs showing the same products. Sites with many filter and sort options can create thousands of near-duplicate addresses. A canonical tag on each variation pointing to the main version tells search engines which one to index, and keeping internal links to the clean version helps too.
What not to put in a URL
- Passwords, tokens and personal data. URLs are saved in browser history, server logs and analytics, and can be passed to other sites in the Referer header.
- Very long data. Browsers and servers have length limits; use a form submission instead.
- Anything that must not be bookmarked or shared, since a URL is made to be copied.