URL Encode and Decode: Percent-Encoding and Parameter Safety
Discover why spaces become %20 in URLs, how percent-encoding preserves query string integrity, and avoid broken API parameters.
What is URL Encoding (Percent-Encoding)?
Uniform Resource Identifiers (URIs) only support a defined set of standard ASCII characters. Spaces, accented letters, and reserved symbols (such as ?, &, =) are converted into a percent sign followed by two hexadecimal digits (e.g., space becomes %20).
β Frequently Asked Questions (FAQ)
What is the difference between encodeURI and encodeURIComponent? βΎ
encodeURI leaves full URL separators (like /, :, ?) intact, whereas encodeURIComponent encodes all punctuation to safely embed parameters.