Learn · Technical SEO · Beginner

How to set and check a canonical URL

Learn to tell Google which address of a page you prefer, make your site agree with that choice, and see in Search Console which address Google actually picked.

By Dean Cruddace · 30 minutes to do · Updated · Last reviewed

What a canonical URL is

The same page can often be reached at more than one web address, for example with and without a tracking code on the end, or on both http:// and https://. Google's documentation also lists regional versions in the same language, mobile and desktop versions, and sorted or filtered category pages.

When Google finds pages that seem to be the same, it groups them and picks one to show in search results. That address is the canonical URL.

You can tell Google which address you prefer, but this is a hint, not an instruction: Google may choose a different one. This guide shows you how to state your preference, make your site agree with it, and check the result.

Why the canonical address matters

Google says some duplicate content is normal and is not a breach of its spam policies, but that many addresses for one page can confuse people and make it harder to track how your content performs in search. Stating a preference can help you choose which address people see, bring signals such as links into one address, and avoid crawling time spent on duplicates. Google also says none of the methods is required: if you specify nothing, it picks the version it judges best. See Google's guidance on specifying a canonical.

What you need to set and check a canonical URL

  • Access to Google Search Console with the site added as a property
  • A web browser, for viewing a page's source code
  • Three to five pages you suspect are reachable at more than one address
  • A way to edit the page head, which in WordPress or similar is often a setting or an SEO plugin

Set and check a canonical URL, step by step

  1. 1

    Choose the one address you want

    For each page, decide which single address you want people to see, and write it in full including https://.

    You will know it worked when You have a list pairing each page with exactly one full, preferred address.

  2. 2

    See what the page declares now

    Open the page, right-click, choose View page source and search (Ctrl+F) for canonical. Look for a line like <link rel="canonical" href="https://example.com/page" /> inside the <head>. Google accepts this element only in the head. Finding none is allowed.

    You will know it worked when You have noted the canonical address each page declares, or that it declares none.

  3. 3

    Add or correct the canonical link

    Put a rel="canonical" link in the head of each duplicate page, pointing at the preferred address. Google also recommends adding it to the preferred page itself, pointing at itself. Use the full address, not a relative path like /dresses/green; Google supports relative paths but advises against them. In a content management system, look for a canonical setting. Use the HTML link or the HTTP header method, not both. See how to specify a canonical.

    You will know it worked when View source again: the head holds one canonical link with the full preferred address.

  4. 4

    Make your other signals agree

    Google lists redirects and rel="canonical" as strong signals and sitemap inclusion as a weak one, and says combining methods raises the chance your preferred address is chosen. So list only preferred addresses in your sitemap, and link internally to the preferred address, not a duplicate. If you are retiring a duplicate page, use a permanent redirect. Google says to use these only for that. Google also prefers HTTPS over HTTP.

    You will know it worked when Open your sitemap in the browser and confirm it lists the preferred addresses. Click a few internal links and confirm they land on them.

  5. 5

    Inspect the address in Search Console

    Paste the full page address into the inspection bar at the top of Search Console. Open Page indexing and read User-declared canonical (what your page states) and Google-selected canonical (what Google chose). Google says the canonical can be found only in the indexed data; the live test cannot predict it. See the URL Inspection help.

    You will know it worked when You can see both fields, and whether they show the same address.

  6. 6

    Act on any difference, then recheck

    If Google's choice differs from yours, look for a signal pointing elsewhere: a sitemap entry, an internal link or a redirect. Fix it, then recheck. The report shows the last indexed version of the page, not the live one, so a fix will not show until Google has processed the page again. If the inspected URL redirects, the results describe that URL, not the destination.

    You will know it worked when Once Google has reprocessed the page, the two fields match. If not, Google does not promise they will, so keep your signals consistent.

Common mistakes when you set and check a canonical URL

  • Pointing signals at different addresses, such as one in the sitemap and another in the canonical link. Google says not to.
  • Using robots.txt to handle duplicates. Google says not to, as it may still index disallowed addresses without their content.
  • Using noindex to choose between duplicates. Google does not recommend it because it blocks the page from search completely.
  • Using the URL removal tool for duplicates. Google says it hides all versions of an address.
  • Setting the canonical in both HTML and an HTTP header. Google says using both is more error prone.

Terms used when you set and check a canonical URL

Canonical URL
The address Google chooses as the main one for a group of duplicate or very similar pages.
rel="canonical"
A link in a page's head (or an HTTP header) that names the address you prefer for that content.
Sitemap
A file listing the addresses you want Google to know about. Google treats inclusion as a weak canonical signal.
Permanent redirect
A server instruction that sends visitors and Google from an old address to a new one for good.
Page head
The hidden top section of a page's HTML, holding details such as the title and canonical link.
Google choosing a different address from the one you declared?

Tell Dean which pages show a different Google-selected canonical and what the page source declares. A reply from Dean is how it starts, not a sales sequence.

Talk to an SEO specialistTechnical SEO: crawling and indexing →