URL Encoding and Decoding: What %20 Means and Why It Matters
Why URLs Need Encoding
URLs can only contain a specific set of ASCII characters. Characters outside this set (spaces, special characters, Unicode) must be percent-encoded: each byte represented as %XX where XX is the hexadecimal value. Example: space → %20, # → %23, & → %26, = → %3D.
Reserved vs. Unreserved Characters
Unreserved characters (safe to use without encoding): A-Z, a-z, 0-9, hyphen (-), underscore (_), period (.), tilde (~). Reserved characters have special meaning in URL syntax: /, ?, #, &, =, +, @. When these characters appear in data (query parameter values) rather than as URL structure, they must be encoded.
encodeURI vs. encodeURIComponent
JavaScript provides two functions: encodeURI() encodes a full URL but preserves reserved characters (/, ?, &, =). encodeURIComponent() encodes a URL component (query param value) — it encodes reserved characters too, making it safe for values within query strings. Use encodeURIComponent for parameter values; encodeURI for full URLs.
Frequently Asked Questions
Encode or decode any URL
Use the free URL Encoder/Decoder to convert URLs and query strings.
Open URL Encoder