Blog › Technical SEO

How to check a canonical tag (3 ways)

Three quick ways to see which canonical URL a page declares, what Google actually chose, and the canonical mistakes that quietly split your rankings.

· 3 min read · By SEO Loop

A canonical tag tells search engines which URL is the main version of a page. When it is right, you never think about it. When it is wrong, rankings split across duplicates, the wrong URL appears in results, or a page you care about gets dropped as a "duplicate".

Checking one takes under a minute. Here are three ways, from quickest to most authoritative.

Way 1: look at the page source

Open the page, right-click, choose View page source, and search for canonical. You are looking for one line in the <head>:

<link rel="canonical" href="https://example.com/shoes/">

Three things to confirm:

  • There is exactly one canonical tag.
  • It is inside the <head>. A canonical placed in the body is ignored.
  • The URL is the one you want ranked: right protocol (https), right host (with or without www, matching your site), no tracking parameters.

If the page is built with JavaScript, the source may show nothing while the rendered page has a canonical. In that case open DevTools, go to the Console, and run:

document.querySelector('link[rel=canonical]')?.href

Way 2: use a command

Reading source by hand is slow across many pages. The same check from a terminal:

curl seoloop.in/meta/example.com

The output lists the final URL after redirects, the title, description and the declared canonical together, so you can see at a glance whether they agree. Here is the real output for seoloop.in:

final_url:          https://seoloop.in/
title:              SEO Loop — SEO checks for your terminal
canonical:          https://seoloop.in/
robots:             -

Non-HTML files such as PDFs cannot hold a <link> tag. They declare a canonical in an HTTP header instead: Link: <https://example.com/guide.html>; rel="canonical". You can read headers with curl seoloop.in/headers/example.com/file.pdf.

Way 3: ask Google what it chose

A canonical tag is a hint, not a command. Google can pick a different URL if it believes another is the better main version. To see its decision, open Google Search Console, paste the URL into the inspection bar and expand Page indexing. Two lines matter:

  • User-declared canonical: what your page says.
  • Google-selected canonical: what Google decided.

When they differ, Google disagrees with you. Usual causes: the pages are near-duplicates, the declared canonical redirects or errors, or internal links and the sitemap point somewhere else.

Canonical mistakes worth hunting for

  • Canonical points to a redirecting or broken URL. The target should return 200.
  • Canonical points to a different, unrelated page. This tells Google to drop the current page.
  • Conflicting signals. A canonical to page A while the sitemap and internal links all use page B.
  • Canonical plus noindex. Telling Google to consolidate on another URL and also noindex the page sends mixed messages. Use one or the other. See robots.txt vs noindex vs canonical.
  • Relative or wrong-host URLs. Use absolute URLs with the right protocol and host.
  • Every page canonicalised to the home page. Usually a template bug, and it removes your inner pages from search.

Should every page have one?

Yes. Even a page with no duplicates benefits from a self-referencing canonical (a canonical pointing to itself). It protects you from tracking parameters and scraped copies.

Quick checklist

  • One canonical per page, in the head
  • Absolute URL, correct protocol and host
  • Target returns 200 and is indexable
  • Matches the URL in your sitemap and internal links
  • Search Console shows the same URL as Google-selected

Next, make sure the page can be indexed at all: how to check if a page is noindex.

Technical SEOcanonicalindexing