Canonical tags: what they are and how to use them
A canonical tag tells search engines which URL is the main version of a page. It's one short line in the <head>, and it decides which of your URLs appears in search when several show the same content.
What a canonical tag is
The canonical URL is the one address you want search engines to treat as the real home of a piece of content. The canonical tag is how you say so:
<link rel="canonical" href="https://example.com/shoes/">
Put it on every version of the page, including the main one. When Google finds several URLs with the same content, it groups them and picks one to show in search results; Google calls this canonicalization. Your tag is a strong signal in that choice, alongside redirects, which URLs are in your sitemap, and whether a URL uses HTTPS.
It is a hint, not a command. Google's documentation says it may pick a different URL than the one you declare, usually because other signals disagree with your tag, or because the pages aren't actually similar enough.
Why duplicate URLs exist
Most duplicates aren't copied content. They are one page reachable at many addresses:
https://example.com/shoes/ https://example.com/shoes/?utm_source=newsletter https://example.com/shoes/?sort=price https://example.com/Shoes/ http://example.com/shoes/
Google lists the usual sources: region variants, mobile and desktop versions, HTTP and HTTPS, and site functions such as sorting and filtering. Each variant can collect links and get crawled separately. A canonical tag pulls them together, so the signals count towards one URL and the URL you chose is the one people see in results.
Duplicate content of this kind isn't penalised. Google says some duplicate content is normal and isn't a violation of its spam policies.
How to add one
In the HTML
Add a link element to the <head>, with the full URL:
<head> <title>Running shoes</title> <link rel="canonical" href="https://example.com/shoes/"> </head>
Google only accepts the tag in the <head>. A canonical in the <body> is ignored, which can happen when an element that doesn't belong in the head, such as an image or a script that writes HTML, closes it early.
In the HTTP header
Files without an HTML head, such as PDFs, can send the canonical as a response header:
Link: <https://example.com/guides/sizing.pdf>; rel="canonical"
Use one method per page. Google discourages sending both the header and the HTML tag, because doing both is more error prone.
Self-referencing canonicals
The main version should name itself as canonical. It costs nothing and protects you from the variants you can't predict, such as parameters added by ad platforms or other sites linking with odd capitalisation. Most CMSs and SEO plugins add self-referencing canonicals automatically.
Across domains
A canonical can point to another domain. That's useful when the same content legitimately lives on two of your own sites, for example after merging two blogs. For articles republished by partners, Google's current advice is different: the most effective solution is for the partner to block indexing of the copy, rather than relying on a canonical.
Canonical, redirect or noindex?
All three keep a URL out of search results, but they do different jobs:
| Method | Visitors see | Use it when |
|---|---|---|
Redirect (301/308) | The new URL | The old URL has no reason to exist: HTTP to HTTPS, non-www to www, moved or merged pages. Google treats it as a strong canonical signal. |
rel="canonical" | The URL they opened | Both URLs need to work for visitors: tracking parameters, sorting and filtering, product variants, print versions. |
noindex | The URL they opened | The page shouldn't be in search at all: internal search results, thank-you pages, account pages. Not for duplicates; Google advises against noindex for canonicalization within a site. |
Robots.txt isn't on the list. If a duplicate is blocked from crawling, Google can't read its canonical tag, and Google warns that blocked URLs may still be indexed without their content. See robots.txt vs noindex for how blocking and noindex differ.
Common mistakes
- Canonical pointing to a URL that redirects, returns 404 or is noindex. The canonical must be a live, indexable page that returns
200. - Every page canonicalised to the homepage, usually a template or plugin setting hard-coding one URL. Only the homepage can then be indexed.
- Paginated pages pointing to page 1. Page 2 lists different items from page 1, so it isn't a duplicate. Give each page in a sequence its own canonical.
- Language versions pointing to one language. Translations aren't duplicates. Each should be canonical to itself and linked with hreflang tags.
- Two canonical tags with different URLs, often one from the theme and one from a plugin. That's a contradictory signal, and Google may disregard it.
- Conflicting signals elsewhere. Google's documentation warns against declaring different canonical URLs through different methods, for example a sitemap listing
/shoeswhile the tag says/shoes/. Use the same exact URL in the tag, the sitemap and internal links. - Relative or fragment URLs. Relative URLs are supported but can cause problems, so use full URLs. Don't use a
#fragment; Google generally doesn't support fragments in canonicals. - Canonicals changed by JavaScript. Put the tag in the HTML the server sends, and make sure scripts don't rewrite it.
How to check your canonicals
For a single page, the SEO Checker reads the canonical tag and the header version, and flags a missing canonical, conflicting canonicals and a canonical pointing to another URL, along with the rest of the page's tags:
To see what Google decided, open URL Inspection in Search Console: it shows the User-declared canonical next to the Google-selected canonical. If they differ, the page usually has one of the mistakes above, or isn't as similar to its canonical as you thought.
For a whole site, the Duplicate Content Checker groups duplicate and near-duplicate pages and shows which ones a canonical already handles. The Website SEO Audit reports missing canonicals and canonicals that point to redirects or broken pages. The Search Console statuses these problems cause are explained in Duplicate without user-selected canonical and Alternate page with proper canonical tag.
Questions
What is a canonical URL?
The URL you want search engines to treat as the main version of a page when the same content is reachable at several addresses. It's the one that appears in search results and collects the signals of all the variants.
Does every page need a canonical tag?
It isn't required, but it's good practice. A self-referencing canonical on every indexable page means parameter and other variants are consolidated automatically, without Google having to guess.
Is a canonical tag the same as a 301 redirect?
No. A redirect sends visitors and crawlers to another URL. A canonical leaves the page where it is and only tells search engines which URL to index. Redirect when the old URL shouldn't exist; use a canonical when both versions need to work.
Why did Google ignore my canonical tag?
Because it is a hint. Google overrides it when other signals point elsewhere, such as redirects, sitemap URLs or internal links using a different version, or when the pages aren't really duplicates. Check URL Inspection to see which URL Google chose.
Can a page have a canonical tag and noindex?
It's best not to. A canonical says "index the other URL instead", while noindex says "don't index this". Pick the one that matches your intent: canonical for duplicates, noindex for pages that shouldn't be in search at all.