Skip to the content

Query String Parser

Paste a URL, or only its query string, and get the parameters decoded in a table. Edit, reorder or remove them, or copy them as JSON.

Query parameters (6)

  • In the URL: q=flat+white

  • In the URL: sort=price%3Aasc

  • Tracking parameter

Parts

Scheme
https
Host
shop.example.com
Port
443Not in the URL: 443 is the default for https
Path
/search
Query
?q=flat+white&size=large&size=small&sort=price%3Aasc&page=2&utm_source=newsletter
Fragment
#results
Origin
https://shop.example.com

Path segments

  1. 1search

Decoded for reading

https://shop.example.com/search?q=flat white&size=large&size=small&sort=price:asc&page=2&utm_source=newsletter#results

Every %XX is turned back into its character. Easier on the eyes, but not always a working link: a decoded & or # changes where the parts end.

Share this tool:TwitterFacebookLinkedInWhatsAppEmail

How a query string is read

The query string is the part of a URL behind the first question mark, up to a hash sign if there is one. Reading it takes three steps.

  1. Cut it at every &. Each piece is one parameter.
  2. Cut each piece at its first =: the name is in front of it, the value behind it. A piece without = is a name with an empty value.
  3. Decode both. A + becomes a space, and every % with two hex digits becomes one byte; the bytes together are read as UTF-8.

The address this page opens with, taken apart that way:

Pieceq=flat+whiteNameqValueflat white
Piecesize=largeNamesizeValuelarge
Piecesize=smallNamesizeValuesmall
Piecesort=price%3AascNamesortValueprice:asc
Piecepage=2NamepageValue2
Pieceutm_source=newsletterNameutm_sourceValuenewsletter

A query string by itself, such as q=tea&page=2, can be pasted as well. It is read the same way, and what you change is written back without a question mark.

Characters that cannot go into a value as they are

A character that has a job in a URL has to be percent-encoded when it is meant as plain text. The table does that for you when you type a name or a value.

CharacterspaceWritten as%20A space cannot be part of a URL at all. In a query a plus sign stands for one too.
Character&Written as%26Would start the next parameter.
Character=Written as%3DSeparates a name from its value.
Character+Written as%2BLeft as it is, it is read as a space.
Character#Written as%23Would end the query and start the fragment.
Character%Written as%25Starts an escape itself.
CharacteréWritten as%C3%A9Everything outside ASCII is written as its UTF-8 bytes, two for this letter.

The same name more than once

Nothing forbids size=large&size=small, and the table keeps both. What a program makes of it differs. In JavaScript, URLSearchParams.get("size") returns the first value and getAll("size") returns both. PHP keeps the last one, unless the name ends in square brackets, as in size[]=large&size[]=small: then it builds an array.

A name without a value

?debug and ?debug= both carry a parameter called debug with nothing in it, and URLSearchParams gives an empty text for either. They are different texts all the same, so an address that was signed or cached in one form does not match the other. The table leaves a parameter in the form it came in.

The URL parser page covers the rest of an address: scheme, host, port, path and fragment, and which tracking parameters the button removes.

See all 12