A canonical tag, also known as rel="canonical", is an HTML element that indicates the preferred version of a web page to search engines. This is crucial for SEO when duplicate or near-duplicate content exists across multiple URLs.
Its primary purpose is to:
- Prevent duplicate content issues – Websites often have the same or very similar content accessible via different URLs (e.g.,
example.com/productandexample.com/product?sessionid=xyz). Canonical tags tell search engines which URL is the main one to index. - Consolidate link equity – When multiple URLs show the same content and receive backlinks, a canonical tag helps consolidate the ranking signals (like PageRank) to the designated canonical URL, improving its overall ranking.
- Improve crawling efficiency – By identifying the primary version, canonical tags guide search engines to focus crawling efforts on important pages, avoiding wasted resources on duplicate content.
How it works:
The canonical tag is placed in the <head> section of the HTML code of the duplicate page. It looks like this:
HTML
<link rel="canonical" href="https://www.example.com/preferred-url/" />
Here, https://www.example.com/preferred-url/ is the URL of the main, canonical version of the page.
When to use a canonical tag
- When content is accessible via different URLs (e.g., with or without trailing slashes, different case sensitivity).
- For product pages with variations or filtered/sorted views that generate unique URLs but display largely the same content.
- When content is syndicated or republished on other websites.
- For HTTP and HTTPS versions of the same page.
- For mobile and desktop versions if they have distinct URLs but similar content.
Important considerations
- Self-referencing canonicals – It is good practice to include a canonical tag on the canonical page itself, pointing to its own URL.
- Absolute URLs – Always use absolute URLs in canonical tags (e.g.,
https://www.example.com/page/, not/page/). - One canonical per page – Do not include multiple canonical tags on a single page, as search engines will likely ignore them.
- HTTP headers – For non-HTML documents like PDFs, canonical tags can be implemented in the HTTP header response.
- Hints, not directives – While highly influential, canonical tags are considered hints by search engines, not strict rules. Google may still choose a different URL as canonical if other strong signals suggest it.

