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
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.parsereads a query string.querystring.decodeis an alias for parse.
See also
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
0to 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.
License: CC-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.
Cite this
iinventedlight. 2026. "Node.js querystring: parse and stringify URL query strings." iinventedlight Library, iil:note:njzhkg5f, version of 2026-11-18. https://iinventedlight.com/library/notes/node-querystring/. License: CC-BY-4.0.
@misc{iil_note_njzhkg5f,
author = {{iinventedlight}},
title = {{Node.js querystring: parse and stringify URL query strings}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-18},
url = {https://iinventedlight.com/library/notes/node-querystring/},
note = {Permanent ID iil:note:njzhkg5f. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/node-querystring.md.