SEO

Canonical Tag Explained: What It Is and How to Use It

Talha Aslan 18 min read 2 views

What is a canonical tag?

A canonical tag is a link element that tells search engines which URL is the main version when several URLs show the same or very similar content. You place it in the head of the page as rel=canonical. Google treats it as a strong signal, not a command, so the final choice stays with Google.

Say a product page loads at three different addresses. Also, the search engine has to pick one to show in results. Also, if you do not state a preference, Google makes its own guess, and that guess is not always the version you want.

The canonical tag is the lightest fix for duplicate content. It also does not delete the page, redirect anyone, or change what visitors see. It only tells the crawler which address you want counted.

In this guide we walk through the syntax, the main use cases and the mistakes we see most often. If duplicate content is new to you, start with what duplicate content is and whether it hurts SEO.

What does a canonical tag tell search engines?

A canonical tag names the URL that should represent a group of duplicate pages. Google's documentation calls it a strong signal. In practice Google follows your hint most of the time, but it can pick a different URL when other signals disagree.

Three terms are worth keeping apart:

  • Canonical URL: the main address you want to appear in search results.
  • Duplicate URL: any other address that serves the same content and points to the canonical.
  • Google-selected canonical: the address Google actually treats as the main one. It can differ from yours.

When the two differ, Search Console shows it. You then need to find out why Google chose another address. Our guide on canonical issues and how to detect them in Search Console walks through that process.

The tag also consolidates signals. Links and ranking signals gather on the main address instead of spreading across duplicates. As a result, one page carries the full weight.

How do you write a canonical tag? Syntax and example

A canonical tag is a single link line inside the head of the page. The format looks like this: <link rel="canonical" href="https://www.example.com/shoes/red-sneaker/" />. If you place it in the body, Google ignores it.

Follow these rules when you write it:

  • Use the full address, with protocol, domain and path. Do not use a relative path such as /shoes/red-sneaker/.
  • Set only one canonical per page. Two different tags can make Google ignore both.
  • Do not use a URL fragment (#). Google generally does not support fragments.
  • Keep letter case, trailing slashes and the www choice consistent with the rest of the site.

You can also let your CMS generate the tag. To prepare meta tags in bulk, try our meta tag generator.

After you publish, open the page source and check the output. In practice, on dynamic sites this is the only reliable way to see whether the template builds the right address.

What is a self-referencing canonical tag?

A self-referencing canonical points to the page's own URL. Google's documentation recommends adding rel=canonical to the canonical page itself. As a result, if a copy ever appears, you have already declared the main version.

This helps most on sites that can generate parameters. Next, when someone adds a tracking parameter to your URL, the copy inherits the same canonical tag. The tag still names the main address, so the copy points to the right place on its own.

A self-referencing canonical does no harm, because the page already counts as its own main version. Consistency matters, though. Using it on some pages and skipping it on others makes the setup hard to manage.

  • Add a self-referencing canonical to every indexable page.
  • Make the tag match the URL you list in your sitemap exactly.
  • Never point a canonical at a redirected or 404 address.

When should you use a canonical tag?

Use a canonical tag whenever the same content opens at more than one address. In addition, most of these cases appear without anyone noticing. Also, the table below lists the most common situations and the usual fix.

SituationExample URLsWhat the canonical points to
Protocol and www differencehttp://example.com and https://www.example.comYour preferred https version
Tracking parameter/product?utm_source=mailThe clean URL without parameters
Filters and sorting/shoes?color=red&sort=priceThe main category page
Trailing slash difference/about and /about/One preferred format
Print or mobile version/product/print/The main product page
Syndicated contentThe same article on another siteThe original article

The best fix can differ by row. For protocol and www, for example, a redirect beats a canonical. The next section explains why.

What is the difference between a canonical tag and a 301 redirect?

A 301 redirect sends both users and crawlers to another address. A canonical tag leaves users where they are and only tells the crawler your preference. According to Google's duplicate URL documentation, redirects and rel=canonical are both strong signals, while a sitemap is a weak one.

Feature301 redirectrel=canonical
What the user seesThe target addressThe page they opened
Old URL still reachable?NoYes
Best used whenA page moved for goodBoth versions must stay open
Signal strengthStrongStrong, but a hint

In short, redirect when the old page is gone. Choose a canonical when users still need both versions, as with a filtered list. Watch out for chains, too; our post on redirect chains and how to fix them explains the problem.

You can test your redirects with our redirect checker.

How do you use a canonical tag with parameter URLs?

With parameter URLs, the right canonical depends on whether the parameter changes the content. If it does not (utm tags, session IDs, referral codes), the canonical should point to the clean URL. If it does, you need to ask whether each version has its own search value.

This approach works on most sites:

  1. Split your parameters into two groups: those that change content and those that do not.
  2. Point the non-changing ones to the clean URL with a canonical.
  3. Leave filter pages that people search for, such as color or brand, with a self-referencing canonical.
  4. Point low-value combinations, such as sorting or multi-filter views, to the main category.

A common mistake is to point every filtered page to the main category. Pages with real search demand then cannot rank. Identify the filters people search for first, and decide after that.

Do not use robots.txt in place of a canonical. Google advises against it, since a bot cannot read the canonical tag on a page it is not allowed to open. We cover robots.txt rules in what robots.txt is and how to create it.

How does a canonical tag work on paginated and filtered pages?

In pagination, each page lists different products, so each page has its own content. Pointing page 2 and page 3 to page 1 is therefore wrong. Every page should carry a self-referencing canonical; otherwise, products on later pages may not reach the search engine.

Filtered pages are more complex. Moreover, these rules work for most e-commerce sites:

  • Each paginated page points to itself.
  • Filter combinations nobody searches for point to the main category.
  • If you have a view-all page, measure its load speed before you make it the canonical target.
  • Link pagination with real a href links that crawlers can follow.

Example calculation: a category has 12 listing pages, and all of them point to page 1. The search engine then favors only the products on page one. Then, access to the rest depends on internal links and the sitemap. For example, we chose this number only to illustrate the case.

What is a cross-domain canonical tag?

A cross-domain canonical points from a page on one domain to a URL on another domain. Google supports this. You use it when you republish content on a partner site and want the original on your own site to count as the main version.

Both sides need to cooperate. Next, the publishing site must agree to point its canonical at your URL. However, if it does not, Google makes its own choice, and the other site can outrank you.

This method makes sense in a few cases:

  • You republish a blog post on an industry portal.
  • You serve the same product catalog on two domains.
  • You cannot set up redirects for some pages during a domain move.

For permanent moves, use a 301 redirect instead. Because a canonical is only a hint, it is not strong enough for a migration.

How do you set a canonical tag with an HTTP header or a sitemap?

Google accepts three methods: the link element in the head, an HTTP header and a sitemap. The link element does not work for non-HTML files such as PDFs. For those files, you add a header like Link: <https://www.example.com/report/>; rel="canonical" to the server response.

A sitemap is a weak signal. In addition, you list only canonical URLs there, and Google leans toward them. It still works out for itself which URL is the duplicate.

One rule matters here: never declare different canonicals for the same page through different methods. Also, if the HTML points to one URL and the sitemap to another, Google resolves the conflict on its own.

  • If you use both a link element and an HTTP header for one URL, make them identical.
  • Do not put non-canonical URLs in the sitemap.
  • Keep your sitemap clean with our XML sitemap generator.

Date values matter too; see our post on the sitemap lastmod tag.

What happens if you add a canonical tag with JavaScript?

A canonical tag added with JavaScript can work, but it is a riskier path. Google's documentation says to set the canonical in the HTML source and make sure JavaScript does not change it. Also, if you cannot set it in the HTML, leave it out and set it only with JavaScript.

The problem appears when the server sends one URL and JavaScript later changes it to another. Google then sees conflicting signals, and that can lead it to ignore the canonical.

For single-page applications, follow these steps:

  1. Generate the canonical on the server and include it in the first HTML response.
  2. Confirm in the browser developer tools that JavaScript does not rewrite the tag later.
  3. Open the URL Inspection tool in Search Console and look at the rendered HTML.
  4. Check that the tag updates when users move between pages.

In other words, you compare the source code with the rendered page. In other words, if both show the same canonical, you are fine.

Can you use a canonical tag and noindex together?

No. Using a canonical and noindex on the same page sends conflicting signals. For example, the canonical says to move signals to another URL, while noindex asks Google to drop the page. Google's documentation also advises against using noindex to prevent canonical selection.

The two serve different goals. A canonical merges duplicate versions. Noindex is for pages that should not appear at all. Do not use one in place of the other.

GoalRight toolWhy
Merge duplicate versions on one URLrel=canonicalMoves signals to the main URL
Keep a page out of searchnoindexPrevents indexing
Block crawlingrobots.txtLimits crawler access
Move a page for good301 redirectSends users and bots to the new URL

For the details, read noindex vs nofollow and robots.txt. If Search Console shows an exclusion for noindex, our post on excluded by noindex tag helps.

How do canonical tags and hreflang work together?

On multilingual sites, each language version should point to itself. Google's documentation says that with hreflang you must specify a canonical page in the same language, or the best possible substitute language if none exists.

The most common mistake is to point every language version to a single language, such as English. Google then treats the other languages as duplicates, and hreflang stops working.

  • Each language version has a canonical that points to its own URL.
  • Hreflang tags are reciprocal: page A points to B, and B points to A.
  • Canonical and hreflang URLs match exactly.

To build the tags, use our hreflang generator. To learn the rules, read what the hreflang tag is.

What are the most common canonical tag mistakes?

The most common mistakes are placing the tag in the wrong spot, pointing to a redirected or unreachable URL, and pointing every page to the homepage. Moreover, these errors waste signals and show up as warnings in Search Console.

In site reviews, our team often finds these cases:

  • The tag sits in the body or in a broken head, so Google never sees it.
  • The canonical points to an old URL that redirects with a 301.
  • Every page points to the homepage, so content pages lose value.
  • The tag uses a relative path, and Google reads it against the wrong base.
  • Two different canonical tags appear on the same page.
  • The canonical target carries noindex or hits a robots.txt rule.

For the diagnosis and fix of each one, read our canonical issues guide. You can also see how these errors look in reports in our Google Search Console guide.

How do you check that a canonical tag works?

To confirm that a canonical works, look at three sources: the page source, the URL Inspection tool in Search Console and the page indexing report. Next, the source shows your tag, and URL Inspection shows which address Google chose.

Work through it step by step:

  1. Find the canonical tag in the page source and confirm the address is correct.
  2. Enter the URL in the URL Inspection tool.
  3. Compare the user-declared canonical with the Google-selected canonical.
  4. If they differ, check whether the two pages are really similar.
  5. List canonical-related exclusions in the indexing report.

Statuses such as alternate page with proper canonical tag are usually normal. The problem is when pages you expected to be canonical show up on that list. For indexing problems, see how to find unindexed pages.

For bulk checks, crawl your URLs and compare the canonical column with the address. Mismatched rows become your review list.

Why can Google ignore your canonical tag?

Google treats the canonical as a hint, not a command. In addition, if other signals conflict, it can override your choice. In practice, redirects, internal links, the sitemap, HTTPS status and content similarity all feed into that decision.

These are the typical reasons Google rejects a canonical:

  • The two pages are not really the same; their content differs clearly.
  • Most internal links point to another address.
  • Your sitemap lists non-canonical URLs.
  • A canonical target returns an error or responds slowly.
  • JavaScript produces a different tag after the page loads.

The fix is to align your signals. Use the same address in internal links, in the sitemap and in the canonical. As a result, Google's preference and yours match.

You can also separate the content for real. Merge two similar pages, or give each one its own value.

What does a canonical tag do for SEO?

A canonical tag gathers the signals that duplicate URLs would scatter. If one page lives at three addresses, you want links and clicks to build up on one of them instead of splitting three ways. As a result, the main page can rank with its full strength.

The second benefit is crawl efficiency. Google focuses on the main version instead of judging each near copy. On sites with thousands of pages, that matters, because every request spent on a duplicate can delay the discovery of new pages.

The third benefit is the right address in results. Moreover, users land on the clean URL, not on a parameter or print version. Sharing, linking and click behavior then build up on the clean address.

  • Signals merge on one URL.
  • Crawl effort shifts from duplicates to main pages.
  • Your preferred URL appears in results more often.
  • You can credit the original source for syndicated content.

Still, a canonical is not magic. Next, if you keep producing duplicates and only cover them with a tag, you postpone the problem. Find the source of the duplicate first, then use the tag as a safety net.

How do you add a canonical tag in WordPress and other systems?

WordPress adds a canonical to most pages by default. In practice, plugins such as Yoast SEO and Rank Math let you manage it in more detail. In most cases, you do not need to write code by hand.

Still, do not assume the automatic output is right on every page. Next, category, tag and archive pages can produce unexpected addresses. Moreover, if two plugins print a tag at the same time, the page ends up with two canonicals.

Whatever the system, follow these steps:

  1. Verify the canonical output of your plugin or theme in the page source.
  2. Turn off the second plugin if it prints a duplicate tag.
  3. Test how parameter and paginated URLs behave.
  4. Test custom post types and product variations separately.

On custom-coded sites, generate the canonical in the template file. Use one function that prints the current URL in full. Then every page follows the same rule, and you fix errors in one place.

How do you set up canonical tags for product variations?

For product variations, the decision depends on whether a variation counts as a separate product for the user. In addition, if color options of one sneaker appear as choices on one page, a single URL is enough. In addition, if each color has its own address, you need to decide.

There are two approaches:

  • If variations differ only by color or size, all of them point to the main product.
  • If a variation has its own search demand and different content, each one points to itself.

Look at search behavior when you decide. If people search for a red model, the red variation page should be indexed at its own address. Also, for variations nobody searches for, pointing to the main product is cleaner.

Also make sure your product schema matches the canonical URL. Also, price and stock data should be correct on the main address. Otherwise, the rich result in search conflicts with the page.

How does a canonical tag work with mobile and AMP pages?

If you run a separate mobile URL (such as m.example.com), the desktop page points to the mobile version with rel=alternate, and the mobile page points to the desktop page with a canonical. Google's documentation says to add the alternate element next to the canonical declaration.

With responsive design, you do not need the pair. Moreover, one address serves every device, and a self-referencing canonical is enough. That is why we do not recommend a separate mobile URL for new projects.

If you maintain an older site with separate mobile URLs, keep these points in mind:

  • Desktop and mobile pages carry the same content.
  • The mobile page points to desktop with a canonical.
  • The desktop page links to mobile with an alternate.
  • Neither address creates a redirect chain.

This setup needs extra upkeep and invites mistakes. In practice, moving to responsive design is usually the healthier option.

What are the most common canonical tag myths?

The biggest myth is that a canonical tag is a command. Google reads it as a strong hint. So adding the tag does not guarantee that Google picks that URL.

Another myth says a canonical removes duplicate content. The tag only gathers signals. Moreover, duplicate pages still exist and still get crawled. And if their content differs a lot, Google may ignore the tag.

We hear these myths most often:

  • A canonical deletes a page from the index: no, it merges.
  • Pointing every page to the homepage is safe: no, it hides your content pages.
  • A canonical replaces robots.txt: no, they do different jobs.
  • A canonical raises rankings: no, it only prevents signal loss.

Because of this, most of these myths come from not knowing the limits of the tag. Think of it as a safety net. To fix the root problem, you also need clean content and a clean URL structure.

Who should own canonical decisions on your team?

A canonical decision looks technical, but it is really a content and product decision. In practice, the SEO lead, the content team and the developer should decide together which page is the main one. Also, if only the developer decides, pages that people search for may end up pointing to the main category.

The workflow we suggest is simple. First, the SEO side lists which addresses carry search value. Then the developer builds those rules into the template. Finally, after launch, you check the Google-selected canonicals in Search Console.

  1. The SEO side lists URLs and parameters with search value.
  2. The developer applies the rules at template level.
  3. After launch, you verify sample URLs in the source code.
  4. Each month, you review Google-selected canonicals in Search Console.

This way, everyone knows who checks what when a problem appears. Moreover, whenever you add a new template, you think about the canonical rule from the start. A template multiplies its mistakes along with its pages.

What is a canonical tag checklist before launch?

Run through the list below before you publish. It is also a short version of the order our team follows in site reviews. Next, each item rules out one class of error in advance.

  1. Does every indexable page have exactly one canonical tag in the head?
  2. Is the address complete, with protocol and domain?
  3. Does the canonical target return a 200 response, with no redirect or error?
  4. Does the target carry noindex or hit a robots.txt rule?
  5. Do the sitemap URLs match the canonical URLs?
  6. On a multilingual site, does each language point to itself?
  7. Does JavaScript change the tag later?
  8. Do parameter URLs point to the clean address?

You apply this list per template, not per page. For example, one check each for the product, category and blog templates is enough. In practice, if the template has the error, it hits thousands of pages at once.

If you need a technical SEO review, take a look at our SEO consulting service. To preview how your result looks in search, try the Google SERP preview tool.

Frequently Asked Questions

Does a canonical tag directly improve rankings?
No, a canonical tag does not raise rankings by itself. Its job is to tell Google which duplicate URL counts as the main one. Because signals gather on a single address, you may see indirect gains. Content quality, links and user experience still decide rankings, so treat the tag as housekeeping, not as a boost.
Should every page have a self-referencing canonical?
Yes, we recommend adding a self-referencing canonical to every indexable page. Google's documentation also advises including rel=canonical on the canonical page itself. If a parameter or copy URL appears later, the main version is already declared. Make sure the tag matches your sitemap and your internal links exactly.
Can a canonical tag use a relative URL?
A relative path can technically work, but Google recommends absolute URLs. Write the protocol, domain and path together, for example https://www.example.com/shoes/. A relative path can be read against the wrong base and produce unexpected addresses. For that reason, we suggest that templates always output the full address, so every tool reads the tag the same way.
Should I choose a canonical tag or a 301 redirect?
Choose a 301 redirect when a page has moved for good, because users and bots both go to the new address. Choose a canonical when both versions must stay open to users, such as a filtered list. Google treats both as strong signals, but a canonical is a hint, so Google may pick another URL.
What should I do if my canonical tag is not working?
First confirm that the tag sits in the head and appears only once. Next, check the Google-selected canonical in the Search Console URL Inspection tool. If it differs, align internal links, the sitemap and redirects with the same address. Also make sure the target returns a 200 and is not blocked by noindex or robots.txt.
Can I use a canonical tag and noindex on the same page?
No, you should not. A canonical asks Google to move signals to another URL, while noindex asks it to drop the page, and that conflict confuses crawlers. Google's documentation advises against using noindex to prevent canonical selection. Use a canonical to merge duplicates, and noindex to remove a page from search entirely.
  • canonical tag
  • rel canonical
  • duplicate content
  • technical seo
  • parameter urls
  • search console
  • hreflang
Share:
Talha Aslan

Google Partner digital marketing expert. Hands-on with SEO, Google Ads, web design and e-commerce projects since 2012; every post here comes from that experience.

Next project

Let's talk about your project.

Your brief goes straight to Talha Aslan and team: strategy led by Talha, delivery by an experienced team. The first consultation is free; we listen and come back with a clear roadmap.