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 stringThe decoded URI.

Browser Support

decodeURIComponent() is an ECMAScript1 (ES1) feature.

ES1 (JavaScript 1997) is fully supported in all browsers:

Chrome Edge Firefox Safari Opera IE
Yes Yes Yes Yes Yes Yes


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.