---
source: https://iinventedlight.com/library/notes/node-querystring.md
title: "Node.js querystring: parse and stringify URL query strings"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "MIT (Node.js docs); MIT (Node.js); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: Node.js docs, Query string; Node.js, querystring.md. MIT (https://raw.githubusercontent.com/nodejs/node/main/LICENSE). Copyright Node.js contributors."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-18
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-18
as_of: 2026-11-18
confidence: medium
untested: "Not reproduced (2026-11-18). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-web: node querystring"
tags: [node, querystring, parse, stringify, url]
client: Librarian
sources:
  - id: S1
    title: "Query string"
    publisher: Node.js docs
    url: https://nodejs.org/api/querystring.html
    accessed: 2026-11-18
    license: "MIT"
  - id: S2
    title: "querystring.md"
    publisher: Node.js
    url: https://raw.githubusercontent.com/nodejs/node/main/doc/api/querystring.md
    accessed: 2026-11-18
    license: "MIT"
---
# Node.js querystring: parse and stringify URL query strings
**Answer:** querystring.parse reads a query string, and querystring.stringify writes one. querystring.decode is an alias for parse, and querystring.encode is an alias for stringify. 

## Examples

```js
import querystring from 'node:querystring';
querystring.parse('a=1&b=2');
querystring.stringify({a: 1, b: 2});
```

## Notes

maxKeys limits how many keys are parsed; specify 0 to remove that limit. By default, percent-encoded characters are assumed to use UTF-8.

## Reference list

- `querystring.parse` reads a query string.
- `querystring.decode` is an alias for parse.

## See also

- [node-http-and-url](https://iinventedlight.com/library/notes/node-http-and-url/)
- [node-buffer](https://iinventedlight.com/library/notes/node-buffer/)
- [node-process-and-console](https://iinventedlight.com/library/notes/node-process-and-console/)

## Claims

- id: C1
  claim: querystring.decode is an alias for querystring.parse.
  source: S1
  evidence: "The querystring.decode() function is an alias for querystring.parse()"

- id: C2
  claim: Prefer URLSearchParams when you want browser-compatible code.
  source: S1
  evidence: "when performance is not critical or when compatibility with browser code is desirable"

- id: C3
  claim: Specify 0 to remove key counting limitations.
  source: S2
  evidence: "Specify `0` to remove key counting limitations."

## Sources

- [S1] Query string. Node.js docs. https://nodejs.org/api/querystring.html . License: MIT. Accessed 2026-11-18.

- [S2] querystring.md. Node.js. https://raw.githubusercontent.com/nodejs/node/main/doc/api/querystring.md . License: MIT. Accessed 2026-11-18.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Node.js docs, Query string; Node.js, querystring.md. MIT (https://raw.githubusercontent.com/nodejs/node/main/LICENSE). Copyright Node.js contributors. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
