X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

JavaScript decodeURIComponent() Function

Function Reference JavaScript Global Functions

Example

Decode a URI after encoding it:

var uri = "http://w3schools.com/my test.asp?name=ståle&car=saab";
var uri_enc = encodeURIComponent(uri);
var uri_dec = decodeURIComponent(uri_enc);
var res = uri_enc + "<br>" + uri_dec;

The result of res will be:

http%3A%2F%2Fw3schools.com%2Fmy%20test.asp%3Fname%3Dst%C3%A5le%26car%3Dsaab     // Encoded URI
http://w3schools.com/my test.asp?name=ståle&car=saab                            // Decoded URI

Try it yourself »


Definition and Usage

The decodeURIComponent() function decodes a URI component.

Tip: Use the encodeURIComponent() function to encode a URI component.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The decodeURIComponent() function is supported in all major browsers.


Syntax

decodeURIComponent(uri)

Parameter Values

Parameter Description
uri Required. The URI to be decoded

Return Value

Type Description
String The decoded URI


Function Reference JavaScript Global Functions

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates FREE Website Templates Free HTML Templates

SHARE THIS PAGE

facebook