The URLSearchParams() constructor creates and returns a new URLSearchParams object.

Note: This feature is available in Web Workers.


var URLSearchParams = new URLSearchParams(init);


init Optional

One of:

  • USVString, which will be parsed from application/x-www-form-urlencoded format. A leading '?' character is ignored.
  • A sequence of USVString pairs, representing names/values.
  • A record of USVString keys and USVString values.

Return value

A URLSearchParams object instance.


The following example shows how to create a URLSearchParams object from a URL string.

// Retrieve params via url.search, passed into ctor
var url = new URL('https://example.com?foo=1&bar=2'); 
var params = new URLSearchParams(url.search);

// Pass in a string literal 
var params2 = new URLSearchParams("foo=1&bar=2");
var params2a = new URLSearchParams("?foo=1&bar=2"); 

// Pass in a sequence of pairs
var params3 = new URLSearchParams([["foo", "1"], ["bar", "2"]]);

// Pass in a record
var params4 = new URLSearchParams({"foo": "1", "bar": "2"});


Specification Status Comment
The definition of 'URLSearchParams()' in that specification.
Living Standard Initial definition.

Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
URLSearchParams() constructorChrome Full support 49Edge Full support 17Firefox Full support 29IE No support NoOpera Full support 36Safari Full support 10.1WebView Android Full support 49Chrome Android Full support 49Firefox Android Full support 29Opera Android Full support 36Safari iOS Full support 10.3Samsung Internet Android Full support 5.0
USVString or sequence for init objectChrome Full support 61Edge Full support 17Firefox Full support 53IE No support NoOpera Full support 48Safari Full support YesWebView Android Full support 61Chrome Android Full support 61Firefox Android Full support 53Opera Android Full support 45Safari iOS Full support YesSamsung Internet Android Full support 8.0


Full support  
Full support
No support  
No support