About this query string builder
The query string is the part of a URL after the question mark, made of key=value pairs joined by ampersands. Spaces, ampersands, and other special characters must be percent-encoded, which is easy to get wrong by hand. This tool builds a correctly encoded query string from plain lines, attaches it to a base URL while keeping any fragment at the end, and lets you choose how spaces and repeated keys are written for the server you are calling. In Decode mode it does the reverse, turning an existing query string or full URL into a readable table and JSON.
How to build a query string
- Choose Build or Decode. Pick Build to create a query string, or Decode to read one. Press an example to see both.
- Enter the parameters. Write one parameter per line as key=value, key: value, or a bare key for a flag. Add a Base URL to get a full address. To decode, paste the query string or URL.
- Set the encoding. Choose how to Encode spaces and how to write Repeated keys, and tick the options you need.
- Press the button. Copy the encoded query string or full URL, and check the parameter table, the JSON, and any warnings.
Frequently asked questions
Should spaces be + or %20?
HTML forms send spaces as +, and most servers decode + as a space in the query string. %20 follows RFC 3986 and is safe everywhere, including in paths. When unsure, use %20.
How should repeated keys be written?
It depends on the server. Repeating the key works with most frameworks, PHP and Rails expect brackets such as tag[]=one, and some APIs use indexes such as tag[0]=one. The JSON view groups repeated keys into a list.
Which characters are encoded?
Everything except letters, digits, and - _ . ~ is percent-encoded, including &, =, ?, #, and non-English letters, so a value can never break the URL. Square brackets in key names are left readable.
What happens to the fragment in a URL?
In Build mode a #fragment in the base URL is kept and placed after the new query string. In Decode mode everything after # is ignored, because browsers never send the fragment to the server.
How long can a URL be?
There is no official limit, but many servers, proxies, and tools fail above about 2,000 to 8,000 characters. The tool warns above 2,000 characters; send large data in a request body instead.