Technical SEO

Setting canonical tags correctly and finding errors

How Google picks the canonical URL and how to avoid conflicts with the sitemap, JavaScript and hreflang.

/table?color=red/table?utm=mail/TABLE//tablecanonical
Michael WeberLast updated: October 15, 20269 min read
In short
  • A canonical tells Google the preferred URL when the same content is available at several addresses.
  • Google treats the canonical as a strong hint and makes the final decision itself.
  • Most problems come from canonicals pointing to redirects, error pages or other language versions, and from conflicts with the sitemap and hreflang.

What is a canonical?

Google calls canonicalization the process of selecting one representative URL from several identical or very similar pages. This canonical URL appears in the search results, and the others count as duplicates. With the link element rel="canonical" you tell Google which URL you prefer. The link relation is defined in RFC 6596 from 2012. According to the RFC, the target must contain the same content or a superset of it.

Google names four reasons for a canonical. You decide which URL appears in search, consolidate signals from similar pages, simplify tracking and save crawl time on duplicates.

How strong is the signal?

MethodStrength according to GoogleWhen it makes sense
301 redirectStrong signalThe old URL is no longer needed
rel="canonical" in the HTML or headerStrong signalBoth URLs stay accessible, for example filters or tracking parameters
Entry in the XML sitemapWeak signalAs a supplement, list only canonical URLs

Google also considers whether a page is served over HTTPS and recommends linking internally to the canonical URL. If you combine several methods with the same target, Google says the chance that your preferred URL appears increases.

Setting the canonical correctly

The element goes in the <head> of the page. Google only accepts it there. The preferred page points to itself, and the variants point to it.

<!-- in the <head> of https://www.example.com/tisch?farbe=rot --> <link rel="canonical" href="https://www.example.com/tisch"> <!-- in the <head> of https://www.example.com/tisch (self-reference) --> <link rel="canonical" href="https://www.example.com/tisch">

For files without HTML, such as PDFs, you set the canonical as an HTTP header.

# HTTP header, for example for a PDF file Link: <https://www.example.com/katalog.pdf>; rel="canonical"
  • Use absolute URLs with protocol and host.
  • Choose one method, HTML element or header. Using both at once makes errors more likely.
  • Only one canonical per page, as RFC 6596 requires.
  • No fragment such as #section as the target.
  • Link internally to the canonical URL.

When do you use a canonical?

CaseRecommendation
Tracking or sorting parametersCanonical to the URL without parameters
Shop filters without their own search demandCanonical to the category without filters
Product variants with almost identical contentCanonical to the main variant
Paginated category (page 2, 3 …)Each page points to itself. Google advises against using page 1 as the canonical.
Print version or AMP pageCanonical to the regular page
Language versions with translated contentNo canonical between them. Each version points to itself, connected via hreflang.
Content replaced without a successor page301 redirect instead of a canonical

The same language for different countries, such as de-DE and de-AT with almost identical text, may be treated by Google as duplicates. For this, Google recommends canonical and hreflang together. In practice, each country version points to itself via canonical and to the others via hreflang. That way Google can show the right URL in each country. How this fits together is explained below and in the hreflang guide.

Canonical via JavaScript

Google recommends delivering the canonical in the HTML. JavaScript should not change it to a different URL. If it can only be set via JavaScript, set it there exclusively and not twice.

Our own test

In 2018, a talk at Google I/O said that canonicals in the rendered HTML were not processed. searchVIU then inserted canonicals on four of its own URLs via Google Tag Manager on 11 May 2018. Google canonicalized all four URLs to the specified target, after 10, 23, 24 and 34 days. The sample was small, and canonicalization can have other causes too. The article Canonical via JavaScript describes the whole process.

In practice, this means that the raw source code and the rendered HTML should carry the same canonical. If they differ, it is unclear which one Google uses.

Canonical and hreflang

A canonical to another URL says that this page should not be in the index. An hreflang says that it should be in the index as a language version. Both on the same URL contradict each other. Three rules follow from this.

  1. Each language version points to itself via canonical.
  2. Pages with a canonical to another URL get no hreflang.
  3. hreflang only points to canonical URLs.

When choosing the canonical URL, Google prefers pages that are part of a reciprocal hreflang cluster. Examples with variants and country versions are in the article hreflang and canonical.

Which canonical does Google pick?

The URL Inspection tool in Search Console shows two fields, “User-declared canonical” and “Google-selected canonical”. If they do not match, the “Page indexing” report gives the reason “Duplicate, Google chose different canonical than user”. Then check whether the pages really are the same and whether internal links, sitemap and redirects point to the same URL. For all pages at once, you need a crawl that compares the canonical of every URL with its status.

Common mistakes

  • The canonical points to a URL with a redirect, 404 or noindex.
  • Relative URLs or the wrong protocol, such as http instead of https.
  • Two canonicals on one page, for example from the CMS and from a plugin.
  • All pages of a template point to the homepage.
  • Page 2 of a category points to page 1.
  • The sitemap contains different URLs from the canonicals.
  • noindex and a canonical to another URL on the same page. Google advises against using noindex for canonicalization.
  • robots.txt blocks duplicates. Google then cannot read the canonical.

Frequently asked questions

What does “canonical” mean?

Authoritative. It refers to the URL that is authoritative for a piece of content.

Do I need a self-referencing canonical?

Google recommends it. It protects the page when it is also accessed with parameters.

Canonical or noindex?

For duplicates within a website, use the canonical. According to Google, noindex removes the page from search entirely.

Why does Google ignore my canonical?

Usually other signals contradict it, such as internal links, the sitemap or redirects, or the pages differ too much in content.

Canonical or 301?

If the old URL is no longer needed, the redirect is the stronger signal. If both URLs remain important for users, for example with filters, the canonical fits.

The searchVIU SEO Audit checks over 100 points with every crawl, including the canonical of every URL. To do this, searchVIU renders every page in Google Chrome and compares the canonical in the raw source code with the one in the rendered HTML. The canonicals topic report shows what has changed since the last crawl. Find out more on the SEO Audit page.

Request a demo

Sources

Retrieved on October 15, 2026. If something is out of date or missing, let us know.

  1. Google, How to specify a canonical URL (Consolidate duplicate URLs): https://developers.google.com/search/docs/crawling-indexing/consolidate-duplicate-urls · As of 10 Jul 2026
  2. Google, What is canonicalization?: https://developers.google.com/search/docs/crawling-indexing/canonicalization · As of 20 Aug 2026
  3. Google, JavaScript SEO basics: https://developers.google.com/search/docs/crawling-indexing/javascript/javascript-seo-basics · As of 4 Mar 2026
  4. Google, Pagination and incremental page loading: https://developers.google.com/search/docs/specialty/ecommerce/pagination-and-incremental-page-loading · As of 10 Dec 2025
  5. RFC 6596, The Canonical Link Relation: https://www.rfc-editor.org/rfc/rfc6596.html · April 2012
  6. Search Console Help, URL Inspection tool: https://support.google.com/webmasters/answer/9012289?hl=en