Eine Beispiel-URL ist in ihre Bestandteile zerlegt und beschriftet: Domain, Pfad, dann das Fragezeichen als Trenner, dahinter zwei Name-Wert-Paare, verbunden durch ein Und-Zeichen, und ganz am Ende der Anker hinter der Raute.

Query String

The query string is the part of a web address after the question mark. It contains additional information for the website, such as a search term, a page number, or a sort order.

Every web address points to a specific page. Often, however, the plain address alone isn’t enough, because the page needs additional information. This additional information sits behind a question mark at the end of the address and is called the query string. An example: in the address “shop.com/search?term=bicycle&page=2”, everything after the question mark is the query string. It tells the page two things: the search is for “bicycle”, and the second results page should be displayed. The structure is always the same: a name, an equals sign, a value. Several such pairs are chained together with the & character.

Why half addresses don’t work

Without a query string, a website would need its own fixed, permanently stored address for every conceivable search. That’s impossible, because no one can know in advance every search term in the world. The query string solves this problem elegantly. The address stays the same; only the values behind it change. The server then assembles the matching page at the very moment the request arrives.

A second advantage: the query string is part of the address and can therefore be copied. If you send someone a link to a filtered product list, that person sees exactly the same list. A bookmark works for the same reason. That sounds obvious, but it isn’t: filters that are only set in the background cannot be shared.

It’s also important to know what does not belong in the query string. Since it’s visibly displayed in the address bar and ends up in server log files, passwords are completely out of place there. For sensitive data, other transmission methods are used, in which the information doesn’t appear in the address.

How names and values come together

The browser appends the query string to the address and sends everything together to the server. The server then breaks the string apart again: first into individual pairs at the & characters, then into name and value at the equals signs. Afterward, the information is available as a clean list that the program on the server continues working with. You can think of it like an order form: the form has labeled fields, and the waiter reads them off line by line.

One detail regularly causes confusion. Certain characters have a fixed meaning within an address, such as the &, the equals sign, or the space. They therefore cannot simply appear as plain text within a value. Instead, they are rewritten—a space, for example, becomes %20. This rewriting is called URL encoding. That’s why copied links sometimes look as if they’re broken, even though everything is correct.

The query string must be distinguished from the path, i.e., the part before the question mark. The path names the resource itself, such as a product page. The query string only changes the display or selection. And one more thing doesn’t belong to it either: everything after a hash sign, the so-called anchor, isn’t sent to the server at all. It only tells the browser which position on the page to jump to.

From online shops to AI interfaces

You see query strings every day, usually without paying attention to them. Search engines put your search query into them, online shops put the selected filters and sort order, video platforms put the video’s ID. Advertising and analytics tags travel along there too, such as parameters like “utm_source”. This allows operators to track which campaign brought a visitor to the site.

The query string also plays a role in the technology behind AI products. Programs communicate with each other via interfaces, i.e., fixed addresses to which requests are sent. Small pieces of information, such as a maximum number of results or a model name, are often passed as query parameters. Larger content, such as a long text for a language model, doesn’t fit there and is transmitted differently. The reason is simple: in practice, addresses may only be a few thousand characters long.

For you personally, the query string is a useful tool. If you change a number in the address bar, you often jump directly to a different results page. And when you share a link, you can usually safely delete unnecessary appendages after the question mark. The core of the address remains intact.

Subscribe free. Unsubscribe the second it sucks.

High-signal news across AI, business, UX, and tech. Every morning.