Technical SEO
What is a canonical tag?
A canonical tag tells search engines which URL is the main version of duplicate pages. Learn how it works, how to set it and which mistakes to avoid.
What rel=canonical does
A canonical tag is a link element in the head of a page that names the preferred URL when the same or very similar content is available at more than one address. It asks search engines to treat that URL as the main version, show it in results, and consolidate signals such as links onto it.
It is a strong hint, not a directive. Google weighs it alongside other signals, including redirects, internal links, sitemap entries and whether a URL uses HTTPS, and can choose a different canonical when the signals disagree. The URL Inspection tool in Search Console shows both the canonical you declared and the one Google selected.
Where duplicate URLs come from
Most duplication is accidental. The same page often answers at several addresses:
- Tracking, sorting and filter parameters, such as ?utm_source=newsletter or ?sort=price.
- HTTP and HTTPS versions of the same page.
- www and non-www hostnames.
- With and without a trailing slash.
- Print-friendly versions, and products that sit under more than one category path.
For protocol, hostname and trailing slash variants, a site-wide 301 redirect is the stronger fix. Use canonical tags when both URLs need to keep working, as with parameter variants.
How to set it correctly
Put one canonical link in the head of the HTML. Use an absolute URL, including the protocol and hostname, and point it at a URL that returns a 200 status and is indexable.
<link rel="canonical" href="https://www.example.com/shoes/trail-runner/">Add a self-referencing canonical to every indexable page, so each one names itself. Generate it from the clean URL rather than the requested one, so parameter and tracking variants point back to the main version. For PDFs and other non-HTML files, send the same hint in a Link HTTP header.
Common mistakes
- Pointing the canonical at a URL that redirects, returns a 404 or carries noindex. Point it at the final, indexable URL.
- Setting every paginated page to canonicalize to page 1. Google advises giving each page in a series its own canonical, because later pages list different items.
- Sending conflicting signals: the canonical names one URL while the sitemap, internal links or hreflang tags use another. Keep them all pointing at the same version.
- Declaring more than one canonical, or injecting one with JavaScript that differs from the one in the HTML. Google may ignore conflicting canonicals.
- Placing the tag in the body. Google only accepts rel=canonical in the head.
- Using noindex or robots.txt to handle duplicates. Neither consolidates signals, and Google advises against both for choosing a canonical.
Put it to work
- Free auditCheck your homepage in about a minute and see a preliminary score with your top issues.
- MovesDrafted fixes with a projected score impact. You approve, the connector applies.
More in Technical SEO
- What are Core Web Vitals?Core Web Vitals measure loading, responsiveness and visual stability. Learn the LCP, INP and CLS thresholds, how they are measured and how to fix them.
- What is structured data and schema markup?Structured data describes a page's content in a format machines can read. Learn JSON-LD, the common schema types, rich results and how to test markup.
- What is an XML sitemap and what goes in it?An XML sitemap lists the URLs you want search engines to find. Learn what to include, how lastmod is used, the size limits and how to submit one.
- Can crawlers see content rendered by JavaScript?Googlebot renders JavaScript, but many AI crawlers appear to read only the raw HTML. Learn how rendering works and how to keep key content visible to both.
- Which redirect should you use: 301, 302, 307 or 308?Permanent and temporary redirects send different signals. Learn when to use 301, 302, 307 and 308, and how to avoid chains, loops and migration mistakes.
- How to control crawling, indexing and snippetsRobots.txt controls crawling, noindex controls indexing and canonicals consolidate duplicates. Learn what each one does and when to use which.
- How to write title tags and meta descriptionsTitles and meta descriptions shape how a page appears in search results. Learn how to write them, why Google rewrites them and how long they should be.