Search Engine Basics

What Is a Canonical Tag? How to Use Rel=Canonical

A canonical tag is a line of HTML that tells search engines which version of a page is the main one. This guide explains why duplicate URLs happen, shows the tag with real examples, then covers the mistakes that cause Google to ignore it.

Updated 26 Oct 20268 min readChecked against Google Search Central
Quick answer

A canonical tag looks like this: <link rel="canonical" href="https://example.com/page/">. It goes in the head of a page. It points to the preferred URL when the same content lives at several addresses. Google treats it as a strong hint, not a strict command.

Usman AliWritten by Usman AliGrowth and SEO specialist · 7 years in SEO

The basics

What Is a Canonical URL, in Plain Words

Imagine one book sold with five different covers. The canonical URL is the copy you ask the library to put on the shelf.

The same page can often be reached at many web addresses. A shop might show one shirt at /shirt/, /shirt/?color=blue, or /shirt/?ref=email. To a person, these are one page. To a search engine, they are separate URLs with the same content.

Search engines do not want to show five copies in results. So they group the copies, then pick one to index. That chosen version is called the canonical URL. The canonical tag is how you tell them which one you prefer. It is part of how search engine indexing handles duplicate content.

Without a canonical

Google guesses

It picks a version on its own. It might choose a messy URL with tracking codes as the one to show.

With a canonical

You guide the choice

You name the clean URL. Google usually follows, then credits links to that one address.

See the code

Canonical Tag Examples You Can Copy

The tag always sits inside the head section of the page. Use the full URL, including https.

Self-referencing canonical

<!-- On https://example.com/shirt/ --> <link rel="canonical" href="https://example.com/shirt/">

Parameter URL points to main page

<!-- On /shirt/?color=blue&ref=email --> <link rel="canonical" href="https://example.com/shirt/">

Republished article on another site

<!-- On partner-site.com/your-article/ --> <link rel="canonical" href="https://example.com/original-article/">

Canonical for a PDF file (HTTP header)

Link: <https://example.com/guide.pdf>; rel="canonical"

Most WordPress SEO plugins add a self-referencing canonical to every page automatically. You only need to change it when a page should point somewhere else. Files like PDFs have no head section, so they use an HTTP header instead.

How Google decides

How Google Picks the Canonical URL

Your canonical tag is one vote among several. Google looks at all of them before it chooses.

SignalStrengthWhat it tells Google
301 redirectVery strongThe old URL has moved for good
rel=canonical tagStrongThis is the version you prefer
Internal linksMediumThe URL your own site links to most
Sitemap URLsWeakerThe URLs you list as important
HTTPS over HTTPWeakerSecure versions are usually preferred

When every signal agrees, Google almost always follows your choice. Trouble starts when they clash. If your tag says /shirt/ but your menu links to /shirt/?color=blue, Google may pick the parameter URL. Keep links, sitemaps or redirects pointing at the same address.

Worked example

One Product, Twelve URLs

Worked example

How filter links split a shop's rankings

This pattern shows up on almost every online shop. A store sells one pair of running shoes. Shoppers can filter by size or color, while emails add tracking codes. Soon one product page exists at a dozen addresses.

  • The problemOther sites link to three different versions. The link value is split, so no single URL ranks well.
  • The signal clashThe sitemap lists /shoes/runner/, while the menu links to /shoes/runner/?size=9.
  • The fixEvery version gets a canonical to /shoes/runner/. Menu links, the sitemap or ads all use the clean URL too.
  • The resultGoogle groups the copies into one cluster. Links count toward one page, so it has a better chance to rank.

Lesson: a canonical tag works best when your whole site points at the same URL.

Avoid these

Common Canonical Mistakes and Fixes

A wrong canonical can quietly remove a page from search. Check for these errors first.

Every page points to home

A theme bug sets the homepage as canonical on all pages. Google may then drop the rest from results.

Check after theme changes

Canonical plus noindex

One tag says index the other URL, while noindex says drop this one. The mixed signal confuses Google.

Pick one method

Pointing to a broken page

A canonical that leads to a 404 or a redirect is ignored. Always point to a live page that returns 200.

Use final URLs
  • Relative URLs. Write the full address with https, not just /page/, to avoid mix-ups.
  • More than one tag. Two canonical tags on a page cancel each other out, so Google may ignore both.
  • Tag in the body. The tag only works inside the head section of the HTML.
  • Using robots.txt instead. Blocking duplicates in robots.txt stops Google from seeing the canonical at all.

Step by step

How to Check Your Canonical Tags

Two quick checks tell you what you set, then what Google actually chose.

01View sourceOpen the page, press Ctrl+U, then search for canonical.
02Inspect URLPaste the page into URL Inspection in Search Console.
03CompareCheck the user-declared canonical against the Google-selected one.
04Fix signalsIf they differ, align links, sitemap or redirects.

The page indexing report also lists pages marked as duplicates. Our guide to checking if a page is indexed walks through that report.

FAQ

Questions About Canonical Tags

Should every page have a canonical tag?

It is a good habit. A self-referencing canonical on every page protects it against copies made by tracking codes or URL parameters.

Is a canonical tag the same as a redirect?

No. A redirect sends visitors to a new address. A canonical tag leaves both pages open to visitors, while asking search engines to show only the main one.

Can a canonical point to another website?

Yes. A cross-domain canonical is common when an article is republished on another site. It tells Google the original version lives elsewhere.

Why did Google choose a different canonical?

Your other signals probably disagree with the tag. Internal links, sitemap URLs or redirects may point to another version, so Google trusts those signals instead.

Do canonical tags pass link value?

Google groups duplicates into one cluster. Signals such as links are then mostly credited to the chosen canonical URL.

Wrapping up

Final Thoughts on Canonical Tags

Duplicate URLs are normal on the web. Filters, tracking codes or printer versions create them every day. The canonical tag is your simple way to say which copy matters. It keeps your link value in one place, so the right page shows in search.

Start with a self-referencing canonical on every page. Most SEO plugins handle that for you. Then make sure your whole site agrees with it. Internal links, your sitemap or redirects should all point to the same clean URL. Check the URL Inspection tool now and then. If Google picked a different canonical, treat it as a hint that your signals disagree. Fix the clash, and Google will usually follow your lead.

Scroll to Top