JavaScript Global Functions
The encodeURIComponent() function encodes a URI component.
This function encodes special characters. In addition, it encodes the following characters: , / ? : @ & = + $ #
Tip: Use the decodeURIComponent() function to decode an encoded URI component.
| Parameter | Description |
|---|---|
| uri | Required. The URI to be encoded |
![]()
The encodeURIComponent() function is supported in all major browsers.
Encode an URI:
The output of the code above will be:
JavaScript Global Functions
Your message has been sent to W3Schools.