Skip to content

Canonical tag

Also called rel=canonical, canonical URL, canonical link element

What is a canonical tag?

A canonical tag is an HTML link element, <link rel="canonical" href="…">, placed in a page’s head to tell search engines which URL is the preferred, main version when the same or very similar content is available at several URLs. Google treats it as a strong hint, not a command, when choosing which URL to index.

Web page layouts connected by a glowing element, showing how a canonical tag designates the primary source.

Duplicate URLs are everywhere. The same product can be reached at /shoes/red-trainers, /shoes/red-trainers?colour=red, /sale/red-trainers and the http and www variants of each. Google groups duplicates into a cluster and picks one URL as the canonical. That URL is the one it crawls most, shows in results and credits with the signals, such as links, from the rest of the cluster.

Several signals feed that choice. Redirects and rel="canonical" are strong signals; inclusion in a sitemap is a weak one. Google also looks at internal links, HTTPS and which URL looks cleanest. When your signals agree, Google nearly always picks your canonical. When they conflict, for example a canonical tag pointing to one URL while your internal links and sitemap point to another, Google may choose for itself.

You can set a canonical in two ways: a <link> element in the HTML head, or a Link HTTP header, which is the only option for non-HTML files such as PDFs. A self-referencing canonical, where a page names its own URL, is good practice: it guards against parameter and tracking variants.

A canonical is not a redirect. Visitors stay on the URL they opened; only search engines consolidate signals. Use a 301 redirect when the duplicate URL should not exist at all.

Why canonical tag matters for SEO

Without clear canonicals, Google may index the wrong version of a page, such as a URL with a tracking parameter, split ranking signals across duplicates, or spend crawl budget on near-identical URLs. Canonicals are the main tool for managing duplicate content that has a legitimate reason to exist.

Bad canonicals do real damage. A template bug that points every page’s canonical at the homepage can drop thousands of pages from the index. Canonicals that point to redirected, 404 or noindexed URLs give Google contradictory instructions, and Google will often ignore them.

Canonical problems are also hard to see in a browser, which is why they are a staple of every SEO audit. The URL Inspection tool in Google Search Console shows both your declared canonical and the Google-selected canonical, and the page indexing report lists pages where Google chose a different one.

How to set canonical tags correctly

  1. Pick the one URL you want indexed for each piece of content: the right protocol (https), host (www or not), trailing-slash style and no tracking parameters.
  2. Add <link rel="canonical" href="…"> inside the <head>, using an absolute URL. Google ignores canonicals placed in the <body>.
  3. Give every indexable page a self-referencing canonical. Point duplicates and parameter variants at the main version.
  4. Use only one canonical per page. Multiple canonical tags that disagree are usually ignored. Check that plugins, themes and your framework are not each adding one.
  5. Make the canonical target a live, indexable URL that returns 200. Never point it at a redirect, a 404, a noindexed page or a URL blocked by robots.txt.
  6. Back the canonical up with your other signals: link internally to the canonical URL, list only canonical URLs in your XML sitemap, and redirect retired duplicates.
  7. Don’t combine noindex and a canonical to a different URL on the same page; they send opposite messages. Don’t use robots.txt to handle duplicates either, because Google then cannot see the canonical tag at all.
  8. For pagination, give each page in a series its own self-referencing canonical. Pointing page 2 and beyond at page 1 tells Google to ignore the items listed on them.
  9. For PDFs and other files, send the canonical in a Link HTTP header.

Canonical tag example

HTML and HTTP header
<!-- On https://www.example.com/shoes/red-trainers?utm_source=newsletter -->
<head>
  <link rel="canonical" href="https://www.example.com/shoes/red-trainers" />
</head>

# For a PDF, as an HTTP response header
Link: <https://www.example.com/guides/sizing.pdf>; rel="canonical"

Canonical tag FAQ

Is a canonical tag a directive?

No. Google treats rel="canonical" as a strong hint. It usually follows it, but it can pick another URL if other signals, such as redirects, internal links and the sitemap, point elsewhere or the pages are not really duplicates.

Should every page have a self-referencing canonical?

Yes, it is good practice. A self-referencing canonical tells search engines that the clean URL is the main one even when the page is reached with tracking or sorting parameters.

Can a canonical tag point to another domain?

Yes. Cross-domain canonicals are supported, for example when you syndicate an article to a partner site and want the original to rank. As with any canonical, Google treats it as a hint.

Canonical tag or 301 redirect?

Use a 301 when the duplicate URL should not be visited at all, such as an old URL after a move. Use a canonical when the duplicate needs to keep working for visitors, such as a filtered or tracked URL.

Related SEO terms

  • Duplicate content

    Duplicate content is the same or very similar content available at more than one URL, on one site or across sites. Google picks one version to show.

  • 301 redirect

    A 301 redirect permanently sends visitors and search engines from one URL to another and tells Google the new URL should be indexed.

  • Noindex

    Noindex is a robots directive, set in a meta tag or HTTP header, that tells search engines not to show a page in search results.

  • URL parameters

    URL parameters are key-value pairs after a ? in a URL, used for tracking, sorting, filtering and pagination. Each variation can look like a new page.

  • Indexing

    Indexing is when a search engine analyses a crawled page and stores it in its index, so it becomes eligible to appear in search results.

  • Pagination

    Pagination splits a long list of items, such as products or articles, across a series of numbered pages, each with its own URL.

  • Hreflang

    Hreflang is an annotation that tells search engines which language or regional version of a page to show to which searchers.

Back to the SEO glossary

Put the terms to work

Every term here is something OpenSEO measures. It is open source: start online in a minute, or run it on your own server.