Analysis updated 2026-06-24
Parse a URL query string into a JavaScript object with automatic number and boolean type conversion
Build a query string from an object using comma-separated or bracket-notation list encoding
Replace the browser native URLSearchParams when you need stricter control over encoding formats
Declare per-field types so parsed values always come back as the right data type without manual casting
| sindresorhus/query-string | ai/size-limit | veltman/flubber | |
|---|---|---|---|
| Stars | 6,903 | 6,906 | 6,907 |
| Language | JavaScript | JavaScript | JavaScript |
| Setup difficulty | easy | easy | easy |
| Complexity | 2/5 | 2/5 | 2/5 |
| Audience | developer | developer | developer |
Figures from each repo's GitHub metadata at analysis time.
query-string is a small JavaScript library for reading and writing the part of a URL that comes after the question mark. That part is called a query string, and it carries data like search terms or filter settings. For example, a URL like "example.com/search?term=cat&page=2" has a query string of "term=cat&page=2". The library provides two main operations. Parsing takes a raw query string and converts it into a plain JavaScript object, so each key-value pair becomes a property you can work with in code. Stringifying does the reverse: it takes an object and produces a properly formatted query string you can attach to a URL. Beyond the basics, the library handles several tricky situations that the browser's built-in alternative does not cover as completely. You can control how lists of values are encoded and decoded, choosing between several formats such as repeated keys, comma-separated values, or bracket notation. There are options to automatically convert values to numbers or booleans instead of leaving everything as a string, and a "types" option lets you declare exactly what type each field should have. Sorting of keys can be customized or disabled. The package is installed via npm and works in both browser and server-side JavaScript environments. The README suggests the browser's native URLSearchParams API for simple cases, and positions this library for situations where finer control is needed. The code and model are both under open-source licenses. The repository is maintained by Sindre Sorhus, a prolific open-source author.
A JavaScript library for parsing URL query strings into objects and stringifying objects back into query strings, with fine-grained control over list encoding, type coercion, and key sorting.
Mainly JavaScript. The stack also includes JavaScript, Node.js.
Open-source license, use freely in personal and commercial projects.
Setup difficulty is rated easy, with roughly 5min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.