normalize-url
10.0.0 · 14 Oct 2026MIT62.8M / weekRepositoryHomepagenpmAtom feed
58 stable releases, newest first, by release line. Notes are quoted as the maintainers published them.
- 10.x · latest line
10.0.0
14 Oct 2026- Breaking
Require Node.js 22 6c95de2
- Breaking
Throw a
TypeErrorwhen thedefaultProtocoloption is not a valid scheme, such as'https://'a8c34ae - Breaking
The query is now always re-serialized, even with
sortQueryParameters: false65f62ef
Breaking
- Breaking
Require Node.js 22 6c95de2
- Breaking
Throw a
TypeErrorwhen thedefaultProtocoloption is not a valid scheme, such as'https://'a8c34ae - Breaking
The query is now always re-serialized, even with
sortQueryParameters: false65f62efPreviously, disabling sorting kept the query exactly as written. Now it is written the way
URLSearchParamswrites it, so%20becomes+and an escape that is not valid UTF-8, like%E9, becomes%EF%BF%BD.
- Breaking
The
removeDirectoryIndexoption now runs aftertransformPath, so the function also receives the index file 65f62ef - Breaking
Many edge cases are now normalized differently (see below). If you store normalized URLs, you may want to normalize them again.
Improvements
The
defaultProtocoloption now accepts any protocol, not justhttpandhttpsb2e4135Strip all whitespace from the ends of a URL, including a non-breaking space and a byte order mark left over from copying 13f62a4
Keep repeated query keys in their original order when sorting 5a3e67a
Normalizing an already normalized URL now always gives the same URL
Document the normalizations that happen regardless of the options bb685bc
Fixes
Fix normalization of the protocol, host, port, path, query, fragment, and data URLs 65f62ef
http:/example.comno longer becomeshttp://http/example.com%252Fin a path no longer becomes%2F, which is a different URLA trailing
/in the query is no longer removednormalizeProtocol: falsenow keeps a protocol-relative URL, even withdefaultProtocol: 'https'A data URL without a comma no longer throws
Fix several data URL cases where the normalized URL was decoded differently by browsers 5d8ff58 cf2aed8 bd39d02
- 9.x
9.0.0
19 Feb 2026- Breaking
Require Node.js 20 c0477f6
Add
customProtocolsoption 0c6c6b9Add
emptyQueryValueoption 2f2536e
Breaking
- Breaking
Require Node.js 20 c0477f6
Improvements
Add
customProtocolsoption 0c6c6b9Add
emptyQueryValueoption 2f2536ePreserve percent-encoded reserved query characters 5630770
- 8.x
8.1.0
10 Sep 2025Add
removePathandtransformPathoption dfcfc06Fix path-like query strings losing structure when sorting parameters 92eb703
8.0.0
4 Nov 2022- Breaking
Require Node.js 14 52f2290
- Breaking
ftpprotocol is no longer normalized. It's just passed through.
Breaking
- Breaking
Require Node.js 14 52f2290
- Breaking
Ignore URLs with custom protocols and just pass them through (#178) 882cb84
By default, these protocols are supported:
https,http,file,data.If you need support for a custom protocol that behaves like a HTTP URL, see #179.
- Breaking
ftpprotocol is no longer normalized. It's just passed through. - Breaking
Human-friendly URLs with basic auth is no longer handled as it conflicts with custom protocols
Example:
user:password@sindresorhus.com
Improvements
Make
defaultProtocoloption accept protocol without colon c7fd781You can still pass in a protocol with colon. However, if you use TypeScript, it enforces it without.
- 7.x
7.2.0
27 Sep 2022Add
removeExplicitPortoption (#174) 192223b
7.1.0
1 Sep 2022Add
keepQueryParametersoption (#173) 6e24307
- 6.x
6.0.1
24 May 2021Reading the note…
6.0.0
7 Apr 2021Reading the note…
- 5.x
5.3.1
24 May 2021Reading the note…
5.3.0
11 Oct 2020Reading the note…
5.2.1
30 Sep 2020Reading the note…
5.2.0
28 Sep 2020Reading the note…
5.1.0
2 Aug 2020Reading the note…
5.0.0
31 Jan 2020Reading the note…
- 4.x
4.5.1
24 May 2021Reading the note…
4.5.0
29 Sep 2019Reading the note…
4.4.1
20 Sep 2019Reading the note…
4.4.0
20 Sep 2019Reading the note…
4.3.0
3 Apr 2019Reading the note…
4.2.0
28 Feb 2019Reading the note…
4.1.0
18 Dec 2018Reading the note…
4.0.0
6 Nov 2018Reading the note…
- 3.x
3.3.0
1 Sep 2018Reading the note…
3.2.0
10 Jul 2018Reading the note…
3.1.0
2 Jul 2018Reading the note…
3.0.1
31 May 2018Reading the note…
3.0.0
27 May 2018Reading the note…
- 2.x
2.0.1
25 Dec 2017Reading the note…
2.0.0
30 Nov 2017Reading the note…
- 1.x
1.9.1
11 Mar 2017Reading the note…
1.9.0
9 Jan 2017Reading the note…
1.8.0
8 Nov 2016Reading the note…
1.7.0
22 Oct 2016Reading the note…
1.6.1
2 Sep 2016Reading the note…
1.6.0
10 Jul 2016Reading the note…
1.5.3
7 Jun 2016Reading the note…
1.5.2
8 May 2016Reading the note…
1.5.1
8 May 2016Reading the note…
1.5.0
1 May 2016Reading the note…
1.4.1
18 Feb 2016Reading the note…
1.4.0
14 Nov 2015Reading the note…
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.