JavaScript decodeURIComponent() Method | Js URL decode
ExampleDecodeaURIafterencodingit:leturi="https://w3schools.com/mytest.asp?name=ståle&car=saab";letencoded=encodeURIComponent(uri);letdecoded=decodeURIComponent(encoded);TryitYourself»[1]DefinitionandUsageThedecodeURIComponent()methoddecodesaURIcomponent.SyntaxParametersParameterDescriptionuriRequired.TheURItobedecoded.ReturnValueTypeDescriptionAstringThedecodedURI.BrowserSupportdecodeURIComponent()isanECMAScript1(ES1)feature.ES1(JavaScript1997)isfullysupportedinallbrowsers:ChromeEdgeFire...
ExampleDecode 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 »[1] Definition and UsageThe decodeURIComponent() method decodes a URI component.
Syntax Parameters Parameter Description uri Required.The URI to be decoded. Return Value Type Description A stringThe decoded URI. Browser SupportdecodeURIComponent() 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 References Try it Yourself » (www.w3schools.com)