Query String Parser
Parse query strings into keys and values.
About this tool
Paste a query string, with or without the leading ? (a whole URL also works, and a #fragment is ignored), and get a JSON object of its keys and values. Percent-codes and plus signs are decoded. If a key appears more than once, only the last value is kept.
How to use
How it works
The string is parsed with URLSearchParams, so %20 and + both become spaces and %26 becomes &. Each pair becomes a property of the result object. Values are always strings.
Worked example
A search query with a repeated key
- Input
- ?q=hello+world&page=2&tag=a&tag=b
- Output
- { "q": "hello world", "page": "2", "tag": "b" }
- Walkthrough
- The plus sign became a space, and tag shows b because the second tag overwrote the first.
Limitations
- Repeated keys keep only the last value; all values are not collected into an array.
- Values are strings, so page is "2", not the number 2.
- Nested keys such as a[b]=1 are not expanded.
Questions
How do I parse a query string?
Does it need the question mark?
What happens to duplicate keys like tag=a&tag=b?
Does it decode %20?
Features
- Decodes %XX and +
- JSON output
- Runs in your browser
Related resources
Guides and videos from around the web—opens on YouTube or the publisher’s site.
Learn JSON - Full Crash Course
freeCodeCamp.org
JSON is the payload format behind many developer tools here.
Watch on YouTubeTypeScript in 100 Seconds
Fireship
Typed JS snippets often get formatted or hashed nearby.
Watch on YouTube
- Introducing JSON
json.org
Canonical JSON grammar for formatters and validators.
- Regular expressions
MDN
JS regex guide aligned with browser-based testers.