A canonical tag is a <link rel="canonical"> 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. Google treats it as a strong signal when choosing the canonical URL, the version it keeps in its index and shows in search results.
At a glance
- Type
rel="canonical"link element in the<head>or HTTPLinkheader- Affects
- choice of the canonical URL for duplicate content
- Binding?
- no, a strong signal; Google can choose another URL
- Specification
- RFC 6596 (April 2012)
Last checked:
How does the canonical tag work?
Duplicate URLs are usually a technical side effect. Filter and sort parameters, tracking parameters, www and non-www hosts, or a product listed in several categories all create extra URLs for the same content. A canonical tag consolidates these variants while keeping all of them accessible to users.
Google treats the tag as a hint and can choose a different URL. It lists three canonicalization methods by strength. Redirects and rel="canonical" are strong signals, and listing a URL in a sitemap is a weak one. When signals disagree, for example when the sitemap lists a different URL than the canonical tag, Google makes its own choice. The URL Inspection tool in Search Console shows which canonical Google selected.
For files without an HTML head, such as PDFs, the canonical URL can be sent in an HTTP Link header. The canonical link relation has been specified in RFC 6596 since April 2012.
| Method | Prevents crawling? | Keeps the URL out of Search? | What Google says | Typical use |
|---|---|---|---|---|
robots.txt Disallow | yes | no, the URL can be indexed without its content if other pages link to it | used mainly to avoid overloading the server with requests; not a mechanism for keeping a page out of Google | Limiting crawler load, excluding areas from being fetched |
noindex in the robots meta tag | no, Google has to be able to fetch the page | yes | only works if the page isn't blocked by robots.txt; Google then drops the page even if other sites link to it | HTML pages that stay reachable but shouldn't show up in search results |
noindex in the X-Robots-Tag HTTP header | no, Google has to be able to fetch the URL | yes | any robots meta tag rule can also be sent as a header; same prerequisite as the meta tag | Files without an HTML head, such as PDFs, images or videos |
rel="canonical" (this term) | no | not directly; a strong signal for which of several duplicate URLs becomes canonical | helps consolidate signals such as links into the preferred URL; don't use robots.txt or noindex for canonicalization | Duplicate and very similar pages, for example from parameters |
| Status code 410 (or 404) | no, but Google gradually fetches the URL less often | yes, a previously indexed URL is removed | treats 404 and 410 the same way | Page permanently removed with no replacement |
| Password protection (login) | yes, crawlers can't reach the content | yes | one of the ways Google lists for permanent removal; authorised users see the page, crawlers don't | Private or confidential content |
| Search Console: Removals | no, Google can keep crawling the URL | hides the URL from search results for about six months | temporary only; 404/410, password protection or noindex make it permanent | Urgent cases, until a permanent measure takes effect |
robots.txt and noindex cancel each other out. If a URL is blocked by robots.txt, Google never sees the noindex, and the URL can still appear in results. Google doesn't support noindex inside the robots.txt file itself. Sources: Google Search Central: Introduction to robots.txt (last updated 2025-12-10); Google Search Central: Block Search indexing with noindex (last updated 2025-12-10); Google Search Central: Robots meta tag, data-nosnippet, and X-Robots-Tag specifications (last updated 2026-03-24); Google Search Central: How to specify a canonical URL (last updated 2026-07-10); Google Crawling Infrastructure: How HTTP status codes affect Google's crawlers (last updated 2026-02-04); Google Search Central: Remove information from Google (last updated 2025-12-10); Search Console Help: Removals and SafeSearch reports tool. Last checked: .
Example
A filtered category page points to the unfiltered category:
<head>
<link rel="canonical" href="https://www.example.com/shoes/" />
</head>
URL of the filtered page: https://www.example.com/shoes/?color=red&sort=price
The same signal as an HTTP header for a PDF:
Link: <https://www.example.com/catalog.pdf>; rel="canonical"
Common mistakes
- Relative URLs. Google recommends absolute URLs. Relative paths can point to the wrong host, for example when a test environment is accidentally crawlable.
- The tag outside the
<head>. Google only accepts the element in the head section. - Canonicalizing with robots.txt or
noindex. Google advises against both for this purpose. A URL blocked by robots.txt cannot be fetched, so its canonical tag is never seen. - Conflicts with hreflang. Google asks for a canonical page in the same language. If the English version declares the German version as canonical, the signals contradict each other.
FAQ
Does every page need a canonical tag?
Google does not require one and says a site will likely do fine without specifying a canonical preference. Google does recommend adding a self-referential rel="canonical" link to the canonical page itself.
What is the difference between a canonical tag and a 301 redirect? A 301 sends users and crawlers to another URL. A canonical tag leaves the page accessible and only tells search engines which version to index.
Does Google use a canonical tag set with JavaScript? Yes, Google can pick it up during rendering, though it doesn’t recommend this approach. JavaScript shouldn’t change the canonical to a different URL than the one in the original HTML. According to a 2018 field test, Google honored canonicals added through Google Tag Manager. The four test URLs took between 10 and 34 days to be canonicalized.
More on the searchVIU blog
Sources
- How to specify a canonical URL with rel="canonical" and other methods – Google Search Centraldevelopers.google.com
- What is URL canonicalization – Google Search Centraldevelopers.google.com
- RFC 6596: The Canonical Link Relationrfc-editor.org
- JavaScript SEO surprise! Google DOES use JS-injected canonical tags. – searchVIU blog (2018)searchviu.com
- Understand the JavaScript SEO basics – Google Search Centraldevelopers.google.com
Last updated: