In the context of the world wide web, a query string is the part of a URL or web address containing data that does not fit into the conventional, path-like structure of a URL.
It's separated from the other parts of the URL by a question mark
Consider this URL:
It consists of the following parts:
httpis the scheme
example.comis the host or server
/cakesis the path
type=chocolate&minimum_available=15is the query string
Query String Format
Although a query string can contain any characters the browser doesn't treat specially, they'll most often look like the query string above, i.e.,
This format encodes a set of key/value pairs. Here,
minimum_available are two keys with the values
Storing Dynamic Information
The query string is a common place to place dynamic, user-supplied data. For example, a website might have a "search" feature. Imagine a URL like
which displays some kind of product search form when a user visits it in their browser. The form contains a text search box and a drop-down to limit the search to a specific product category. When the user submits the form, they might be sent a page containing the search results with a URL like
If we changed
lexmark, we'd get a different set of search results.
Keep in mind this is all hypothetical. These URLs will only do what we describe
if there's a web application on the other end expecting these URLS and
implementing what we describe.