Query-value boundary lab · Updated November 20, 2026

Encode an Ampersand in a URL Query Value

An ampersand inside a query value is data; an unencoded ampersand separates query pairs. Encode it as %26 when the value must stay in one parameter.

Delimiter or data depends on position

Wire formParser seesResult
note=sales&supportnote=sales plus a bare support segmentValue is split.
note=sales%20%26%20supportOne value: sales & supportData survives.
note=a%26b&mode=fullValue a&b and separate key modeOnly the outer ampersand separates pairs.

Measured output

Run date: November 20, 2026. Node.js v24.19.0: encodeURIComponent("sales & support") = sales%20%26%20support. PHP 8.5.12: rawurlencode returns sales%20%26%20support.

Input: sales & support | URLSearchParams wire value: sales+%26+support | Decoded: sales & support

Download the reproducible fixture CSV

Common failure

Do not paste raw user text into a query string and then split on ampersands afterward. Encode the component before joining it to the outer URL.

FAQ

Why does the browser show plus signs?

URLSearchParams serializes spaces with the form-style plus convention; the ampersand itself remains %26. This is distinct from encodeURIComponent, which uses %20 for spaces.

Can I use repeated keys for a list?

Yes, but use a list-aware parser such as getAll() so values are not silently discarded.

For query structure, see Query Parameters. For nested URLs, see nested URL encoding.