What is the difference between URL parameters and query strings?

What is the difference between URL parameters and query strings?

The query component is indicated by the first ? in a URI. Query string might be a synonym (this term is not used in the URI standard).

Some examples for HTTP URIs with query components:


(list of allowed characters in the query component)

The format of the query component is up to the URI authors. A common convention (but nothing more than a convention, as far as the URI standard is concerned¹) is to use the query component for key-value pairs, aka. parameters, like in the last example above: bar1=a&bar2=b.

Such parameters could also appear in the other URI components, i.e., the path² and the fragment. As far as the URI standard is concerned, it’s up to you which component and which format to use.

Example URI with parameters in the path, the query, and the fragment:


¹ The URI standard says about the query component:

[…] query components are often used to carry identifying information in the form of key=value pairs […]

² The URI standard says about the path component:

[…] the semicolon (;) and equals (=) reserved characters are often used to delimit parameters and parameter values applicable to that segment. The comma (,) reserved character is often used for similar purposes.

Parameters are key-value pairs that can appear inside URL path, and start with a semicolon character (;).

Query string appears after the path (if any) and starts with a question mark character (?).

Both parameters and query string contain key-value pairs.

In a GET request, parameters appear in the URL itself:


In a POST request, parameters can appear in the URL itself, but also in the datastream (as known as content).

Query string is always a part of the URL.

Parameters can be buried in form-data datastream when using POST method so they may not appear in the URL. Yes a POST request can define parameters as form data and in the URL, and this is not inconsistent because parameters can have several values.

Ive found no explaination for this behavior so far. I guess it might be useful sometimes to unhide parameters from a POST request, or even let the code handling a GET request share some parts with the code handling a POST. Of course this can work only with server code supporting parameters in a URL.

Until you get better insights, I suggest you to use parameters only in form-data datastream of POST requests.


What Every Developer Should Know About URLs

RFC 3986

What is the difference between URL parameters and query strings?

Ive tried posting a question but cant get past the your title is not good enough. 20 minutes of trying different titles and I gave up. so, heres the question/problem.

I have a peculiar problem using query strings with IIS. If the query string includes an and followed by number I get a 403 error. so &msg=and 1 (&msg=and%201) will produce a 403 error.

Anyone stumble across this one before

Leave a Reply

Your email address will not be published. Required fields are marked *