What is a canonical URL?
A canonical URL is the one preferred address for a page that can be reached through several URLs — with and without www, over http and https, with tracking parameters, with a trailing slash or without. You declare it with <link rel="canonical" href="…"> in the page’s <head>, or with a Link HTTP header for non-HTML files such as PDFs.
Google treats rel="canonical" as a strong hint, not a directive. It combines the tag with other signals — redirects, internal links, sitemap URLs, https and hreflang — to choose the canonical it indexes. When your signals agree, Google almost always follows your choice; when they conflict, it may pick a different URL, which you can see in the URL Inspection tool in Search Console.
This generator normalizes URLs with rules you choose — force https, www or non-www, trailing slash policy, removing tracking parameters, fragments, default ports and index.html — and shows exactly which changes were applied to each URL. Everything runs in your browser; it does not fetch your pages.
How to use the Canonical URL Generator
- Paste one URL, or many URLs one per line.
- Set the rules to match your site: https, www or non-www, trailing slashes, and how to handle query parameters.
- Review the Changes per URL table to confirm each normalization is what your server actually serves.
- Copy the canonical URLs, the
<link rel="canonical">tags or the HTTPLinkheaders.
Example
With the default rules, a messy campaign URL becomes a clean canonical:
Input: HTTP://WWW.Example.com:80/Blog//post-1/index.html?utm_source=newsletter&page=2#comments
Canonical: https://www.example.com/Blog/post-1/?page=2
<link rel="canonical" href="https://www.example.com/Blog/post-1/?page=2">Canonical tag best practices
- Use absolute URLs, including the scheme and host — relative canonicals are allowed but error-prone.
- Add a self-referencing canonical to every indexable page, so parameter and tracking variants consolidate to it.
- Point the canonical only at a URL that returns 200, is indexable and has the same (or nearly the same) content.
- Keep signals consistent: link internally to canonical URLs, list only canonicals in your XML sitemap and redirect old variants with 301s (see the Redirect Generator).
- Do not canonicalize paginated pages to page 1, and never combine a canonical with
noindexon the same page.
Canonical URLs in WordPress
WordPress core prints a self-referencing canonical for single posts and pages through the rel_canonical() function hooked to wp_head. SEO plugins replace it with their own canonical output and add it to archives, and they let you override the canonical per post. If you add a canonical manually in your theme as well, check the page source — two canonical tags with different URLs cause Google to ignore both.
Frequently Asked Questions
Is rel="canonical" a directive or a hint?
A hint. Google usually respects it when other signals agree, but it can choose a different canonical if, for example, your internal links, sitemap and redirects point elsewhere or the content differs.
Should every page have a self-referencing canonical?
It is a good practice. A self-referencing canonical makes URLs with tracking parameters, session ids or different capitalization consolidate to the clean version.
Which query parameters should be removed?
Remove parameters that do not change the content: campaign tags such as utm_source (build them with the UTM Builder), click ids like gclid and fbclid, and session ids. Keep parameters that do change the content, such as pagination or product filters you want indexed — use the allowlist mode for that.
Trailing slash or no trailing slash?
Either works. What matters is consistency: choose the form your server returns with a 200, redirect the other one, and use the same form in canonicals, internal links and your sitemap. File-like URLs such as /guide.pdf never get a trailing slash.
Can I set a canonical for PDFs and other files?
Yes, with the HTTP response header Link: <https://example.com/file.pdf>; rel="canonical". Choose HTTP header in the output format to generate it.