1. License
“Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:”
BSD 3-Clause allows use in paid and closed-source apps.
github.com/ljharb/qs/blob/main/LICENSE.md2. Maintained
github.com/ljharb/qs3. Used by agents' projects
Dependency in 18 public GitHub projects set up for AI coding agents that we scanned (0.3%).
4. Agent access
Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.
From the package registry and GitHub, checked daily; card checked Nov 11, 2026. Tap a verdict to see its source.How we checkedReport an error
What qs does
qs is a small free JavaScript library for the part of a web address after the question mark. It turns text like filter[color]=blue&filter[size][]=M into a ready object your code can read, and turns such objects back into that text. It has built-in limits, so a hostile address cannot make it build huge or deep objects.
What people build with it
Read shop filters from the address
A product list page reads color, sizes and page number from the address bar as one tidy object, so shared links open with the same filters.
Build links with filters
Your app turns the filters a person picked into a link or a request address another service understands, with arrays written the way that service expects.
Refuse hostile addresses on a server
A public search page gets odd addresses from bots; your server rejects ones nested too deep or with huge list numbers instead of quietly reshaping them.
Send form data to older servers
Some older services want data sent like a filled-in web form; qs turns your object into that text before you send it.
Comma lists in short links
A marketing link carries tags=red,green; your page reads it as a list of two tags without extra code.
Keep admin table views in links Idea
An admin page stores sorting, column filters and page size in its address, so a teammate opens exactly the same view from a pasted link.
qs popularity
Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated
How qs is used
- qs is a dependency in 18 of the 6,258 public GitHub projects set up for AI coding agents that we scanned, too few to describe it from them alone. Our scan also samples projects by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750); counting those, it appears in 50 projects, and what it is used with below comes from all of them.
- Projects that use it most often also use Axios (66.0%), ts-node (34.0%), ESLint (70.0%).
By coding agent
Often used with
More about qs
Funding
- GitHub Sponsors: https://github.com/ljharb
- Tidelift: https://tidelift.com/funding/github/npm/qs
- 55 GitHub sponsors
Alternatives
qs This page
Pick query-string for flat parameters with typed values and many list styles; it does not build nested objects from brackets.
Pick nuqs in a React app when you want each URL parameter kept as typed component state, not a one-off parse.
Get started
Tell your AI assistant
“Use qs (pin qs@6.17.1) to parse the page's query string with { ignoreQueryPrefix: true } into a filters object, convert numbers from strings yourself, and build links back with qs.stringify(obj, { encodeValuesOnly: true, arrayFormat: "brackets" }).”
Add qs to your project (pin the version, for example qs@6.17.1), then load it and parse or build a query string.
var qs = require('qs'); var assert = require('assert'); var obj = qs.parse('a=c'); assert.deepEqual(obj, { a: 'c' }); var str = qs.stringify(obj); assert.equal(str, 'a=c');When you read location.search, drop the leading question mark with ignoreQueryPrefix.
var prefixed = qs.parse('?a=b&c=d', { ignoreQueryPrefix: true });Parse once with qs and run your checks on the object it returns, not on the raw text.
Mistakes to avoid
qs never converts types; in our demo page came back as the string "2".
Express 5 changed the default query parser to "simple", which keeps foo[bar] as a flat name.
The two read names differently, so a check on one does not hold for the other.
Past the limit qs quietly returns an object keyed by index; in our run ids[25]=7 gave {"ids":{"25":"7"}}.
Before 6.14.1 the list limit did not apply to the [] form; 6.15.2 also changed how odd bracket keys parse.
Questions
Does it turn "2" into a number?
No. All values come back as strings; convert numbers and booleans yourself, or check them with a schema library.
Is it safe to parse addresses from strangers?
It has limits on depth, parameter count and list size by default. To reject input past those limits instead of trimming it, turn on strictDepth and throwOnLimitExceeded.
Does Express still use qs for req.query?
Not by default in Express 5. Its default query parser changed from "extended" (the qs style) to "simple", so nested brackets are not built for you.
Can I make it encode spaces as + like HTML forms?
Yes. Since 6.17.0 the WHATWG format writes spaces as +, the way URLSearchParams and form posts do.
Can I use it in a paid product?
Yes, under BSD 3-Clause; keep its copyright notice and license text with copies you ship.