URL Encode Query Parameters
Encode query parameter values so special characters do not break URLs or API requests.
Example
Raw value:
hello world & status=active
Encoded value:
hello%20world%20%26%20status%3DactiveCharacters to Encode
| Key / Code | Description |
|---|---|
| space | %20 in encoded query values |
| & | %26 so it does not start a new parameter |
| = | %3D so it stays inside the value |
| # | %23 so it does not become a URL fragment |
Common Mistake
Encode each query value, not the entire URL. In JavaScript, use encodeURIComponent for parameter values and URLSearchParams for building full query strings.
Related
Knowledge is power.