Canonical URL Generator
The Canonical URL Generator cleans any URL by stripping UTM parameters, tracking strings, and optional elements like trailing slashes or the www subdomain, then outputs a properly formatted canonical link tag and XML sitemap loc element ready to copy. view.
Before (normalized)
https://example.com/page?utm_source=newsletter&page=2
After (canonical)
https://example.com/page?page=2
Stripped: utm_source
Canonical tag
<link rel="canonical" href="https://example.com/page?page=2">XML sitemap loc
<loc>https://example.com/page?page=2</loc>Canonical tags should point at the preferred URL for that content. When in doubt, match the URL users see in the address bar without campaign parameters.
How this tool works
The canonical URL generator builds a link rel='canonical' tag that tells search engines which version of a URL is authoritative when multiple addresses serve identical or near-identical content. Before building the tag, the tool applies three normalization rules: it strips tracking parameters (utm_source, utm_medium, utm_campaign, fbclid, gclid) from the query string, normalizes the protocol to https, and removes default ports since they are redundant in canonical declarations. It also flags four common canonical mistakes: trailing-slash inconsistency, www vs non-www mismatch, http vs https mismatch, and session or variant parameters that should not appear in the canonical URL. The output is ready to paste into the HTML head. Key assumption: the tool normalizes the URL you enter and cannot detect whether a conflicting canonical already exists in your CMS output or in an HTTP response header. Edge case: canonical tags in HTTP Link response headers take precedence over in-page canonical tags in most search engines. If your server emits a Link: rel='canonical' header, the in-page tag generated by this tool will be ignored by Google. Verify response headers with a header checker before deployment.
Worked example
A blog post is shared as https://www.example.com/post?utm_source=twitter&ref=home#comments. With strip UTM enabled, ref added to the custom strip list, and www removal on, the tool outputs the canonical as https://example.com/post. Both the HTML link tag and the sitemap loc snippet are ready to copy.
Frequently asked questions
What is a canonical tag?
A canonical tag in the HTML head tells search engines which URL is the preferred version of a page. When multiple URLs serve the same content, canonical tags consolidate ranking signals to the preferred version. Tracking this metric alongside conversion data gives a more complete picture of how changes affect actual business outcomes.
Should I include UTM parameters in my canonical?
No. Your canonical URL should always be the clean, parameter-free version of the page. UTM parameters are tracking codes for analytics. Including them in canonicals splits your ranking signals across tracked and untracked URLs.
Can I canonicalize to a different domain?
Yes. Cross-domain canonicals are fully supported by Google. This is used for content syndication: if your article is published on another site, adding a canonical pointing to your original URL tells Google to attribute rankings to your site.
What is the difference between a canonical tag and a 301 redirect?
A 301 redirect sends users and bots to the new URL automatically. A canonical tag leaves the URL accessible but tells search engines which version to prefer for indexing. Use 301 redirects when content has permanently moved; use canonicals when multiple URLs must remain accessible. Tracking this metric alongside conversion data gives a more complete picture of how changes affect actual business outcomes.
What happens if I have a fragment (#) in my canonical URL?
Google strips fragment identifiers from URLs when processing canonicals. Including a fragment in your canonical is harmless but pointless. The tool warns you if a fragment is present and strips it from the output.
What is an XML sitemap loc tag?
The loc element in your XML sitemap should contain the canonical URL of each page. This tool generates both the HTML canonical link tag and the XML sitemap loc snippet so you can keep both in sync. Tracking this metric alongside conversion data gives a more complete picture of how changes affect actual business outcomes.