Comma query-value boundary lab · Updated November 17, 2026
Encode a Comma in a URL Query Value
A comma in a query value is data unless your application explicitly defines comma-separated lists. Encode the value when you need the receiver to preserve the comma instead of splitting it by policy.
Two interpretations of the same characters
| Wire value | Data interpretation | List interpretation |
|---|---|---|
color=red,blue | One string containing a comma. | Three values only if the application splits commas. |
color=red%2Cblue | Explicitly encoded comma in one value. | Parser should decode it back to red,blue before any policy split. |
color=red&color=blue | Repeated key with two entries. | Use getAll() or a list-aware parser to retain both. |
Node and PHP measured output
Run date: November 17, 2026. Node.js v24.19.0 and PHP 8.5.12 preserve the comma as a query value; neither runtime invents a comma-list policy.
Node.js v24.19.0 → searchParams.get("color") = red,blue; encodeURIComponent = red%2CbluePHP 8.5.12 parse_str → color = "red,blue"; rawurlencode = red%2Cblue
Common failure
Do not assume a comma means an array just because one framework offers that convention. Document the policy, test the raw request, and encode the comma when it must remain data.
FAQ
Is a comma reserved in a query?
It can appear as data, but applications may assign it list semantics. The parser and application contract decide the meaning.
Should I use repeated keys instead?
Repeated keys are often clearer for lists, but preserve them with a list-aware API rather than converting immediately to a single object value.
For array conventions, see Query Parameters. For general component encoding, use the URL Encode tool.