Tested guide
Why a plus sign becomes a space in URL query parameters
Compare a+b, a%2Bb and percent-encoded paths using the browser URL parser.
When URLSearchParams parses a query string, a literal + is decoded as a space. The encoded sequence %2B becomes a literal plus sign. This rule belongs to form-style query parsing; it does not mean that every + in every part of a URL is a space.
The experiment
| Input URL | Decoded parameter pairs |
|---|---|
https://example.com/?q=a+b&literal=a%2Bb | [["q","a b"],["literal","a+b"]] |
https://example.com/a%20b?q=%E4%BD%A0#section | [["q","你"]] |
Computed from the published fixtures using Node.js 22.22.2, ICU 78.2, Unicode 17.0. Run the same examples in your browser.
Read each URL component separately
In the query example, q=a+b yields the value a b, while literal=a%2Bb yields a+b. Our inspector shows the raw query and decoded parameter rows together, so you can compare the two representations.
The pathname of the third example remains /a%20b in the browser URL object. Its query value is decoded into 你. The fragment is displayed separately. A fragment normally remains on the client when making an HTTP request; a page script can still read or transmit it.
Avoid decoding twice
URLSearchParams already decodes query names and values. Applying decodeURIComponent again can reinterpret an intentionally encoded percent sequence or throw an error for an incomplete escape. Decide whether you need raw URL text or already-decoded values before calling another decoder.
For construction, use URL and URLSearchParams APIs with unencoded values when possible, then inspect the final serialized URL. Pre-encoding a value before passing it to an API that encodes again can produce double encoding.
Interpretation is not validation of the destination
Our inspector only parses the text in your browser. It does not check redirects, domain ownership, availability, signatures or whether a website is safe. It also cannot tell you whether a particular server treats + literally instead of using form-style decoding.
Use the sample to understand the browser representation, then check the receiving application with synthetic data. Preserve the original URL whenever exact spelling matters, and never paste credentials into public bug reports.
Standards and references
These results describe the tested implementations and inputs. Report a reproducible discrepancy through our contact page.
Continue exploring
How to read duplicate URL query parameters without losing values ↗
Repeated names, empty values and key-only flags in a concrete parsing example.
Why a plus sign becomes a space in URL query parameters ↗
Compare a+b, a%2Bb and percent-encoded paths using the browser URL parser.