npm install @ferrow/url-normalizer-liteURL canonicalization with scheme/host lowercasing, default port stripping, query sorting, and tracking-param removal.
import { normalize, equivalent } from "url-normalizer-lite";
const messy = "HTTPS://Example.COM:443/path?utm_source=ad&b=2&a=1";
const clean = normalize(messy);
// → https://example.com/path?a=1&b=2
console.log(equivalent(url1, url2)); // true if normalized forms matchCanonicalize a URL:
- Lowercase scheme and hostname
- Strip default ports (80→http, 443→https)
- Resolve dot-segments (.. and .)
- Sort query parameters
- Strip common tracking params (utm_*, fbclid, gclid, msclkid)
- Handle trailing slash per option
Check if two URLs are equivalent after normalization.
interface NormalizeOptions {
trailingSlash?: "keep" | "add" | "remove" // "keep" by default
stripTrackingParams?: string[] // Additional params to strip
}- Punycode domains not decoded (left as submitted)
- Fragment identifier always stripped
- No intelligent cache-busting param detection
Part of the ferrow-toolkit collection · Sponsored by Ferrow