JavaScript decodeURIComponent()
Example
Decode a URI after encoding it:
let uri = "https://w3schools.com/my test.asp?name=ståle&car=saab";
let encoded = encodeURIComponent(uri);
let decoded = decodeURIComponent(encoded);
Try it Yourself »
Description
The decodeURIComponent()
method decodes a URI component.
Note
Use the encodeURIComponent() method to encode a URI component
See Also:
The encodeURI() method to encode a URI
The decodeURI() method to decode a URI
Syntax
decodeURIComponent(uri)
Parameters
Parameter | Description |
uri | Required. The URI to be decoded. |
Return Value
Type | Description |
A string | The decoded URI. |
Browser Support
decodeURIComponent()
is an ECMAScript1 (JavaScriopt 1997) feature.
It is supported in all browsers:
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |