Every URL makes a quiet decision about where its data lives. Some of it sits in the path, as segments of the address itself. The rest rides after the question mark as a query string. The two are not interchangeable styles: they say different things about the data, and putting a piece of data in the wrong place makes addresses harder to share, bookmark and rebuild.
This guide compares the two shapes, using the free Query String Builder on Ovatly to show what the query side looks like when it is built properly: a table of names and values, appended to any base URL whose path is already settled.
Contents
- Quick answer
- What a query string is, mechanically
- What a path parameter is
- The real difference: identity versus options
- When the query string is the right home
- When the path is the right home
- How to build the query side, step by step
- Worked example: options applied to a resource
- Limitations and honest tradeoffs
- Common mistakes
- FAQs
- Conclusion
Quick answer
Use the path for the thing the page is, and the query string for the options applied to it. A query string is a set of name and value pairs after the question mark, read by name, so pairs can be added, removed, reordered or left empty without changing the identity of the address. Search terms, page numbers and tracking codes are classic query data. The identity of the resource, which product or article the address points at, belongs in the path. The Query String Builder builds only the query side, and this guide is upfront about that split.
What a query string is, mechanically
A query string begins at the question mark and is built from pairs: a name, an equals sign, a value, with ampersands between pairs. In https://example.com/search?q=red+shoes&page=2 there are two pairs, q and page. Three properties follow from that shape. The pairs are read by name, so their order almost never matters. They are optional and combinable: a link can carry one pair or ten, and removing one does not break the address. And they are portable: the same pairs can ride on any base URL without changing its path, because the query string is an attachment to the address, not part of its structure.
What a path parameter is
A path parameter is a segment of the path itself: one of the pieces between the slashes that make up the address. Where a query pair is labeled with a name, a path segment is identified by its position in the structure. That makes the path the skeleton of the address. It is what a person reads to know which product, article or profile they are looking at, and it tends to be stable, because restructuring it means restructuring the site. This section stays brief and general on purpose: the builder's job, and most of the practical mistakes, live on the query side.
The real difference: identity versus options
Read an address in two halves. Everything before the question mark answers the question: which thing is this? Everything after it answers: and how is it being viewed, searched or tracked right now? The first half is identity, the second is options. Data that changes the identity, a different product, a different article, belongs in the path. Data that leaves the identity untouched and only adjusts the presentation or records the visit, a search term, a page number, a sort order, a tracking code, belongs in the query string. When that line is respected, addresses stay readable: the path is short and stable, and the query string can grow or shrink without renaming the page.
When the query string is the right home
The cargo the query string was made for is the data a page consumes rather than the data it is: search terms, page numbers, tracking codes and similar values. These share three traits. They are optional, since the page exists without them. They combine freely, since a search can also be on page two and carry a tracking code at the same time. And they are safe to strip: remove the query string and the address still points at the same page, just unfiltered and untracked. If a piece of data passes those three tests, it almost certainly belongs after the question mark.
When the path is the right home
If removing the data would point the address at a different thing, or at nothing, the data is identity and belongs in the path. A product page without its product segment is not the same page with an option removed; it is no page at all. Identity data also earns the stability of the path: it is the part of the address that gets printed, bookmarked and linked to, so it should be the part that changes least.
How to build the query side, step by step
- Open the Query String Builder and enter the base URL. Its path is the identity half of the address; leave it as it stands.
- Add one row per option: a name on the left, its value on the right. Empty values are allowed; a row with a value but no name is rejected.
- Leave encoding on, so spaces become
+and characters like&and#inside values are escaped. - Copy the finished URL. The new pairs are appended after any parameters the base URL already had.
Worked example: options applied to a resource
The builder's example shows the split cleanly. The base is https://example.com/search: the path, /search, is the resource, the store's search page. The rows are q = red shoes and page = 2, and the result is https://example.com/search?q=red+shoes&page=2. Neither pair changes which page this is. Change q and the same page searches for something else; drop page and it shows the first page of results; strip both and the search page is still there. That is the signature of query data: the identity of the address survives its removal.
Limitations and honest tradeoffs
The builder builds the query side only. It cannot restructure a path, rename a segment, or tell you how a particular site expects its data arranged; that belongs to whoever built the site. The identity-versus-options line is a strong rule of thumb, not a law: real sites occasionally put options in paths or identity in queries, and their addresses work anyway, just less readably. And this comparison is about address design, not performance: neither shape is faster, and any claim that one ranks better than the other would need evidence this guide does not have.
Common mistakes
- Putting options in the path. A new path for every sort order or page number multiplies addresses for what is still one page.
- Putting identity in the query string. The address then depends on a pair that can be stripped or lost in a paste, and the link breaks or lands somewhere generic.
- Treating the two as a style choice. They carry different meanings, and readers, including future you, parse them differently.
- Building query strings by hand and breaking the encoding. A raw space or ampersand inside a value corrupts the pairs even when the data is in the right home.
FAQs
What is a query string? The part of a URL after the question mark, made of name=value pairs joined by ampersands. It carries data such as search terms, page numbers and tracking codes, and the receiving site reads each pair by name.
Does the order of query parameters matter? For almost all websites, no. Parameters are read by name, so pairs can be added, removed or reordered without changing what the site does with them. The builder keeps your row order anyway, which helps when comparing two links.
Can a query parameter have an empty value? Yes. A name with nothing after the equals sign, written as name=, is a valid pair. A value with no name cannot be represented, so the builder rejects a row that has a value but no name.
Does the Query String Builder create path parameters? No. It builds the query side only: you enter a base URL, whose path is already set, and add rows of names and values that are appended as the query string. Changing the path itself is a decision about the site's structure, made where the site is built.
When should data go in the path instead of the query string? When it identifies the thing the page is, such as which product, article or profile the address points at. Data that adjusts how that thing is shown, searched, sorted or tracked belongs in the query string as options.
Conclusion
The choice is one question: does this data say which thing the page is, or what is being done with it? Identity goes in the path, options go in the query string, and the Query String Builder handles the query side from a table, with encoding on and existing parameters kept. For the failures that happen even when the data sits in the right place, see our guide to query string mistakes: unencoded spaces and broken ampersands. More guides in this series live in the URL and Link Tools guides.