Canonical Tag: rel=canonical Syntax and How Google Uses It

The rel=canonical link names the preferred URL for duplicate pages. Syntax, HTTP header form, how Google and Yandex use it, and its limits.

4 min read674 words· Updated October 22, 2026

A canonical tag is a <link rel="canonical"> element in the <head> of a page. It tells search engines which URL you prefer when several URLs show the same or very similar content. Put one canonical link with an absolute URL on each page. On duplicate pages, point it to the URL that you want in search results.

Syntax

<link rel="canonical" href="https://example.com/dresses/green-dresses">

RFC 6596 (April 2012) defines the canonical link relation. It names the preferred version of a resource. The target URL must show the same content as the page, or a superset of it. MDN describes it as the preferred URL for the current document.

Google accepts the element only in the <head> section of the HTML. Google also recommends a self-referential canonical: a canonical link on the preferred page that points to its own URL.

HTTP header for PDF and other files

The <link> element works only in HTML pages. For a PDF or another file, send the canonical URL in a Link HTTP response header:

Link: <https://www.example.com/downloads/white-paper.pdf>; rel="canonical"

Google supports this header for web search results. Google recommends that you use the element or the header, not both. Google says that using both is more error prone, because the two can give different URLs.

How Google uses rel=canonical

Google lists three methods to show a canonical preference, from strongest to weakest:

Method Strength, as Google describes it
Redirect Strong signal
rel="canonical" link Strong signal
URL in a sitemap Weak signal

The methods add up, so using two of them together makes your preferred URL more likely to be chosen. But Google calls a canonical preference “a hint, not a rule”. Google can choose a different page as canonical, for example because of content quality or technical signals. If you want to see the URL that Google chose, use the URL Inspection tool in Search Console.

Google gives these best practices:

  • Use absolute URLs. Google supports relative URLs but does not recommend them.
  • Do not use robots.txt to choose a canonical. Google can still index blocked URLs without their content.
  • Do not use noindex to choose a canonical within a site. It removes the page from Search completely.
  • Do not give one page different canonical URLs through different methods. For example, do not put one URL in the sitemap and another in the <link> element.
  • Do not use a URL fragment (the part after #) as the canonical URL.
  • In internal links, link to the canonical URL.
  • If you use JavaScript, put the canonical URL in the HTML source and do not change it with JavaScript.

Google ignores rel="canonical" links that also have hreflang, lang, media or type attributes. For language versions, use rel="alternate" with hreflang.

How Yandex uses rel=canonical

Yandex supports the same element and the same HTTP header. Its canonical URL help gives these rules:

  • Yandex treats the canonical URL as a recommendation and can ignore it.
  • If the canonical page and the non-canonical page have very different content, Yandex ignores the instruction.
  • Give the canonical URL within the same domain, as an absolute URL.
  • Yandex no longer uses rel="canonical" for a move between HTTP and HTTPS. Use a 301 or 302 redirect for that move.

What rel=canonical does not do

  • It does not send visitors to another URL. Both URLs stay open to users. If you retire the duplicate URL, Google suggests a permanent redirect instead.
  • It does not force a search engine to use your URL. Google and Yandex both treat it as a hint.
  • It does not stop crawling of the duplicate page. Google says that it crawls duplicates less often than the canonical page.
  • It is not the method Google recommends for content that partners republish. Google suggests that partners block indexing of the copied content instead.

For rules that remove a page from search, see the meta robots tag.

Markdown version
↧
Loading PDF…