Skip to content
Agents tracked: 506 Releases (7d): 634 Agent status: 3 with issuesSince last limit reset: Claude 15d · Codex 0d For AI agents: Markdown Updated Nov 26, 2026

qs

Turn web address filters into objects and back.

UtilitiesNPM

GitHubWebsite

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.md

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

68 / 100
Gid Score, #483 overall
278M
downloads a week, npm
8,952
GitHub stars
18
agent projects use it
qs: downloads per weeknpm, qs 278,326,512
qs: GitHub starsljharb/qs 8,952

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

12 projects, 0.4%
10 projects, 0.4%
9 projects, 0.3%

Often used with

In 66.0% of its projects
In 34.0% of its projects
In 70.0% of its projects
In 32.0% of its projects
In 82.0% of its projects
In 28.0% of its projects
In 28.0% of its projects
In 60.0% of its projects

More about qs

Funding
  • GitHub Sponsors: https://github.com/ljharb
  • Tidelift: https://tidelift.com/funding/github/npm/qs
  • 55 GitHub sponsors

See all

More in Utilities

Alternatives

qs This page

BSD-3-ClauseGid 68278M/wk

query-string

Pick query-string for flat parameters with typed values and many list styles; it does not build nested objects from brackets.

nuqs

Pick nuqs in a React app when you want each URL parameter kept as typed component state, not a one-off parse.

Compare qs with another tool

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" }).”

  1. 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');
    

    From github.com/ljharb/qs/blob/main/README.md

  2. When you read location.search, drop the leading question mark with ignoreQueryPrefix.

    var prefixed = qs.parse('?a=b&c=d', { ignoreQueryPrefix: true });
    

    From github.com/ljharb/qs/blob/main/README.md

  3. Parse once with qs and run your checks on the object it returns, not on the raw text.

    From github.com/ljharb/qs/blob/main/README.md

Mistakes to avoid

if (query.page > 1) or query.debug === true right after qs.parse
Convert values yourself (Number(query.page), query.debug === "true") or validate with a schema

qs never converts types; in our demo page came back as the string "2".

Expecting nested req.query objects in Express 5 out of the box
Switch the query parser back to "extended", or parse the raw query with qs yourself

Express 5 changed the default query parser to "simple", which keeps foo[bar] as a flat name.

Checking or signing the query with URLSearchParams and then reading it with qs
Parse once with qs and run allow lists and checks on the parsed object

The two read names differently, so a check on one does not hold for the other.

Treating arrayLimit as a hard cap and reading ids as an array
Set throwOnLimitExceeded: true, or check Array.isArray before use

Past the limit qs quietly returns an object keyed by index; in our run ids[25]=7 gave {"ids":{"25":"7"}}.

A lockfile pinning qs below 6.14.1 on a public server
Update to 6.17.1 (or at least the newest patch of your minor line)

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.