Input
Output
🔗 How the URL Encoder/Decoder Works
URLs can only contain a limited set of safe ASCII characters. Percent-encoding (also called URL encoding) converts unsafe characters into a %XX hexadecimal format so they travel safely across the web.
Encode: encodeURIComponent(text) // encodes everything except: A-Z a-z 0-9 - _ . ! ~ * ' ( )
Decode: decodeURIComponent(encoded)
1
Each unsafe character is converted to its UTF-8 byte representation. Each byte is expressed as
%HH where HH is the two-digit hex code.2
For example, a space (byte 0x20) becomes
%20. The ampersand & (0x26) becomes %26. This keeps URL query strings unambiguous.3
encodeURIComponent vs encodeURI: the component version also encodes / ? # & = + @ making it safe for individual query parameter values.
Example: Encode "hello world & more"
Space → %20 | & → %26
Result: hello%20world%20%26%20more
Space → %20 | & → %26
Result: hello%20world%20%26%20more
Uses the browser's native encodeURIComponent() / decodeURIComponent() — no external libraries needed.