Percent-encode URLs or decode percent-encoded strings. Supports query strings, special chars, and Unicode.
URL Encoding (also called percent-encoding) replaces unsafe ASCII characters with a % followed by two hex digits. It's required by RFC 3986 so URLs can be safely transmitted in HTTP requests.
encodeURIComponent β encodes everything except A-Z a-z 0-9 - _ . ! ~ * ' ( ). Use for query string values.encodeURI β leaves URL-reserved chars (: / ? # [ ] @ ! $ & ' ( ) * + , ; =) alone. Use for complete URLs.Input: hello world?name=John&age=30
encodeURIComponent: hello%20world%3Fname%3DJohn%26age%3D30
+ sometimes mean space?application/x-www-form-urlencoded (form submissions), + means space. Pure URL percent-encoding uses %20.