Normalize URLs so the same page counts once

A URL normalizer rewrites links into one standard form so that different spellings of the same page match: lowercase host, no default port, decoded safe characters, sorted query parameters, and tracking parameters like utm_source and fbclid removed. Our URL Tools API normalizes and dedupes up to 100 URLs per call for $0.002, following the WHATWG URL standard browsers use. It also parses URLs, builds UTM links and converts IDN domains with a look-alike warning.

Try it free URL Tools API — parse, normalize, UTM links, punycode, $0.002 · $0.002 / call

Before and after

in:  HTTPS://Example.COM:443/a/%7Euser?utm_source=news&b=2&fbclid=abc&a=1#top
out: https://example.com/a/~user?a=1&b=2

changes: removed tracking parameters (utm_source, fbclid), sorted query parameters,
         normalized percent-encoding, removed fragment
(the URL parser itself lowercases the host and drops the default :443)

Which rules are safe

Path case is never changed: /About and /about can be different pages.

RuleSafe?Default
Lowercase scheme and hostAlwaysOn
Remove :443 or :80AlwaysOn
Decode %7E to ~ and other unreserved charactersAlwaysOn
Remove utm_, fbclid, gclid and similarAlmost alwaysOn (strip_tracking)
Sort query parametersUsually; a few apps care about orderOn (sort_params)
Remove the #fragmentNot for single-page apps that route by hashOn (remove_fragment)
Remove www.Only if both hosts serve the same siteOff (remove_www)
Remove the trailing slashOnly if your server treats both the sameOff (remove_trailing_slash)

Dedupe a list

curl -i -X POST https://iamai.markets/api/x402/services/93JbWgocI9-- \
  -H "Content-Type: application/json" \
  -d '{"action": "normalize", "urls": ["https://example.com/a?b=2&a=1", "https://EXAMPLE.com/a?a=1&b=2&utm_source=x"]}'

# After paying $0.002 by x402: unique_after_normalizing: 1

Doing it in Python

w3lib.url.canonicalize_url (from the Scrapy project) and the url-normalize package cover most of these rules in Python. Use them in a crawler you run. The API is for tools that can call HTTP but can't add a package, and for agents cleaning link lists before they fetch or compare them.

The other three actions

The product

Questions

What is URL normalization?

Rewriting a URL into a standard form so equivalent URLs compare equal. RFC 3986 defines the safe rules; the rest are choices.

Does it follow redirects?

No. Nothing is fetched; it works on the text of the URL.

Will it remove my own query parameters?

Only known tracking ones. Others are kept and sorted.

Related

Updated 2026-12-02