JavaScript (ES2026) reference · JSON and Global Functions

JavaScript decodeURI() Function

Decode a full URL encoded by encodeURI(), keeping escape sequences that represent reserved URL characters.

JavaScript (ES2026) Since ES3

Create a free account to save this page, take notes and track your progress. Sign in

Syntax

decodeURI(encoded)

Parameters

ParameterDescription
encoded An encoded URL.

Return value

A decoded string.

Examples

Decode a URLTry it yourself
console.log(decodeURI("https://example.com/my%20file.pdf"));

Output

https://example.com/my file.pdf
%26 (&) stays encoded with decodeURI()Try it yourself
console.log(decodeURI("a%26b"), decodeURIComponent("a%26b"));

Output

a%26b a&b

Version history

VersionChange
JavaScript ES3Added

Was this page helpful?