Canonical tag
By Thibault · Updated
A canonical tag is a link element, rel="canonical", that tells Google which URL is the main version of a page when several URLs show the same or very similar content.
Why does the canonical tag matter?
The canonical tag decides which URL gets indexed and shown when your content exists at several addresses. Duplicates come up all the time: HTTP and HTTPS versions, sorting and filtering parameters on category pages, separate mobile pages, or a demo site that crawlers can reach. Google groups these pages, picks one representative and crawls the others less often. If you don't tell Google which one you want, it chooses for you.
How does a canonical tag work?
You add the tag in the head of each duplicate page, pointing to the preferred URL. For example, a product page reached through example.com/shoes?color=red would carry <link rel="canonical" href="https://example.com/shoes">. For files that have no head, like PDFs, you can send the same signal in an HTTP header. Google recommends picking one of the two methods, since using both makes errors more likely.
Google treats the tag as a strong signal, but it remains a hint. In its own words, "indicating a canonical preference is a hint, not a rule." A permanent redirect is also a strong signal, and listing a URL in your sitemap is a weak one. When all of them point to the same URL, your choice is far more likely to win.
What mistakes break a canonical tag?
- Using relative URLs. Google supports them but recommends absolute URLs.
- Declaring one canonical in the tag and a different one in the sitemap.
- Blocking the duplicate in robots.txt, so Google can never read the tag.
- Using noindex to choose a canonical inside the same site.
- Changing the canonical with JavaScript instead of setting it in the HTML source.
- Linking internally to the duplicate instead of the canonical URL.
How do I check which canonical Google chose?
The URL Inspection tool in Search Console shows two fields: the user-declared canonical and the Google-selected canonical. If they differ, Google disagreed with you. The Google-selected value only appears for indexed results, not in the live test.
Frequently asked questions
Is a canonical tag a directive?
No. Google calls it a hint, not a rule. It is a strong signal, but Google can pick a different URL if your other signals contradict it.
Should a page have a canonical tag pointing to itself?
Yes, I recommend it. A self-referencing canonical protects the page when parameters or tracking codes create new URLs for the same content.
What is the difference between a canonical tag and a 301 redirect?
A redirect sends users and crawlers to the new URL, so the duplicate is no longer reachable. A canonical tag keeps both pages accessible and only tells Google which one to index. Use a redirect when you retire a page, and a canonical when the duplicate has to stay live.
