A JavaScript (npm) package that normalizes URLs by producing a consistent string format. It is useful for displaying, storing, deduplicating, sorting, and comparing URLs, with options to adjust protocols, strip authentication, hashes, query parameters, and other URL parts (and it explicitly does not perform URL sanitization).
Project status
- Actively maintained: Recent activity is consistent, with updates in 2025-09, 2026-02, 2026-05 (v9.0.1), plus an upstream push on 2026-07-21, indicating ongoing development rather than a dormant state.
- Update cadence: After the major v9.0.0 in 2026-02, a patch update (v9.0.1) followed about 3 months later, suggesting a regular maintenance rhythm in addition to periodic feature additions.
AI summary generated
Recent updates
v9.0.1
Release v9.0.1 contains a targeted fix for the `removeExplicitPort` option when the input URL is `localhost:<port>`. It also includes additional test coverage around how the library handles “custom schemes” like `tel:` and `sms:` when `removeExplicitPort` is enabled.
v9.0.0
v9.0.0 introduces a new `customProtocols` option to allow normalization of additional schemes, plus an `emptyQueryValue` option to control how empty query parameters are rendered. The implementation also adds logic to preserve percent-encoded reserved query characters. The release notes are missing a notable behavioral change around how RegExp query filters with `g` or `y` flags are handled.
BreakingFeaturesv8.1.1
v8.1.1 primarily fixes `removeDirectoryIndex` so it treats trailing slashes consistently. The code diff also includes a small refactor in the Data URL normalization logic (`normalizeDataURL`), even though that is not mentioned in the release notes.
v8.1.0
v8.1.0 introduces two new normalization options, removePath and transformPath, to give callers control over how the URL pathname is handled. It also fixes a specific case where path-like query strings could lose structure when sortQueryParameters is enabled. Overall, the changes are additive plus a targeted behavior fix around query sorting.
Featuresv8.0.2
v8.0.2 focuses on fixing how normalize-url handles encoded backslashes in URL pathnames. The code change ensures that percent-encoded backslashes remain percent-encoded in the normalized output, and new tests were added to lock that behavior in.
v8.0.1
v8.0.1 focuses on fixing how the library interprets protocol-less URLs that include a port. The code change adjusts protocol detection so inputs like a host plus port are normalized using the default protocol rather than being treated as a custom protocol.
Breakingv8.0.0
v8.0.0 is a major release of normalize-url that raises the minimum Node.js version to Node 14 and changes how non-HTTP style protocols are treated. It also updates the `defaultProtocol` option to accept `http` or `https` without the trailing colon (with TypeScript type enforcement).
Breakingv7.2.0
v7.2.0 introduces a new option, `removeExplicitPort`, to control whether an explicitly provided port in a URL should be stripped during normalization. The release notes only mention this feature, and the code changes align with that by adding the new option to the implementation, typings, README, and tests.
Featuresv7.1.0
This release adds a new `keepQueryParameters` option to `normalize-url`, allowing callers to retain only specific query parameters. The implementation also changes the interaction with the existing `removeQueryParameters` logic so that the new option takes precedence when provided.
Featuresv7.0.3
v7.0.3 contains a targeted fix for query parameter encoding inconsistencies when `sortQueryParameters` is enabled. The implementation changes how the query string is handled after sorting and updates tests accordingly.