How to Check Canonical URL of a Website

Small business owner checking a canonical URL on a laptop, with a highlighted line in the page source on screen and a printed SEO checklist on the desk.

Direct answer

Check the canonical URL of a website by reading what the page declares, testing where that address leads, and asking Google what it chose. View the page source and search for rel=”canonical”, check the HTTP header with curl, then compare both with the user-declared and Google-selected canonicals in Search Console URL Inspection. When all three agree, the check is done.

What are you actually checking?

A canonical check answers three different questions, and each needs its own tool. Mix them up and you will trust an answer to a question you never asked.

First, what the page declares. That is the preference your site supplies: either a link element in the HTML head, or a Link header in the HTTP response. Search Console calls it the user-declared canonical, per canonicaltag.com.

Second, where that address leads. A well-formed tag can still name the wrong page, per canonicaltag.com. The declared URL might redirect, return an error, or point at a page that is no longer the one you meant.

Third, what Google chose. Google treats a canonical preference as a hint, not a rule, per canonicaltag.com, citing Google. Only the indexed result in Search Console’s URL Inspection shows which URL Google actually chose, per canonicaltag.com. A third-party checker can only read what the server sends; it cannot see Google’s choice at all, per canonicaltag.com.

If the check finds a problem and you need to change the tag, our guide on how to set canonical URL in WordPress shows the Yoast and Rank Math steps.

Check What it answers Tool
View source What the page declares in HTML Browser, Ctrl+U
curl header check What the server sends in the header Terminal, curl
Rendered page What JavaScript leaves in the page DevTools Elements
URL Inspection What Google chose Search Console

Step 1: Check view source

View Source shows the HTML exactly as the server delivered it, before any script runs, per canonicaltag.com. Open the page in a browser, press Ctrl+U on Windows or Cmd+U on a Mac, and search for canonical. Checking one page this way takes under a minute, per seoloop.in. Work through five checks on what you find.

Count the matches. One is correct. Two or more is a problem regardless of whether they agree in value, per canonicaltag.com. Google’s 2013 guidance was that with multiple declarations it will likely ignore all of them, per canonicaltag.com.

Check what comes before it. Google stops reading the head at the first element that does not belong there, such as an iframe or img, per canonicaltag.com. A canonical sitting after such an element may never be read at all.

Read the href. It should be absolute, with the scheme, per canonicaltag.com. A value such as example.com/page has no protocol and resolves as a relative path, so it points somewhere nobody intended, per canonicaltag.com. A relative URL works in principle, but an absolute URL with protocol and host removes any doubt, per abacklaunch.com.

Look for extra attributes. A canonical carrying hreflang, lang, media or type is not used for canonicalization, per canonicaltag.com.

Look for a fragment. Google generally does not support URL fragments, so a fragment in a canonical target is wasted, per canonicaltag.com.

If you find nothing, record “not found in source”, not “no canonical anywhere”, per openmultiurl.com. JavaScript or a response header may still supply one, and a missing declaration does not mean Google cannot choose a canonical on its own.

Step 2: Check the HTTP header with curl

A canonical sent as an HTTP header never appears in View Source, and for PDFs and other non-HTML files the header is the only way to declare one, per canonicaltag.com. Non-HTML files such as PDFs cannot hold a link tag; they declare a canonical in an HTTP header instead, per seoloop.in. Curl reads the header directly:

curl -sI https://www.example.com/page
curl -s -D - -o /dev/null https://www.example.com/page
curl -sIL https://www.example.com/page

The first line asks for headers only, using a HEAD request. The second asks for the headers of a real GET, with the body discarded. The third follows redirects and reports each hop’s headers, per canonicaltag.com.

The line to look for has the form Link: <https://www.example.com/page>; rel=”canonical”, per canonicaltag.com. Three details keep the result honest. First, some servers answer HEAD differently from GET, so if the first command shows nothing, repeat with the GET form before concluding there is no header, per canonicaltag.com. Second, the -L form matters because a redirect is itself a strong canonical signal, and a page that redirects has expressed its preference before any tag is read, per canonicaltag.com. Third, a header canonical and an HTML canonical on the same page must name the same URL, per canonicaltag.com. When they disagree, search engines have no reliable way to tell which you meant, per abacklaunch.com.

Step 3: Compare source with the rendered page

View Source shows the starting point. The DevTools Elements panel shows the live DOM, the page as it exists after scripts have added, removed or edited nodes, per canonicaltag.com. On a JavaScript-heavy page the two can differ, and the difference is the diagnosis.

View Source Elements panel What it means
Canonical A Canonical A Consistent; the normal case
No canonical Canonical A Injected by JavaScript. Google can pick it up during rendering, but any raw-HTML checker will report it missing
Canonical A Canonical B Rewritten by JavaScript, the pattern Google’s guidance warns against
Canonical A Canonical A and B A script added a second tag instead of replacing the first, producing multiple declarations

Google’s JavaScript guidance draws the line clearly: you should not use JavaScript to change the canonical URL to something else than the URL you specified as the canonical URL in the original HTML, per canonicaltag.com, citing Google. A script-injected canonical has to be the only one on the page, per canonicaltag.com. The safest arrangement is a correct canonical in the server HTML that no script touches, per canonicaltag.com.

If the page is built with JavaScript and the source shows nothing, open DevTools, go to the Console, and run this one-liner, per seoloop.in:

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

It prints the href of the canonical in the live page, or nothing if there is none. Browser extensions that display the canonical generally read the live DOM, so treat them as a version of the Elements view, not of the source, per canonicaltag.com.

Step 4: Ask Google what it chose

Open Google Search Console and paste the URL into the URL Inspection tool, per canonicaltag.com. The indexed result reports both answers side by side: the user-declared canonical shows the declaration Google found, and the Google-selected canonical shows what it chose, per canonicaltag.com. When they match, the canonical is working. When they differ, Google overruled you.

Three Search Console statuses describe the common outcomes, per abacklaunch.com. “Alternate page with proper canonical tag” means this URL points elsewhere and Google agreed, so usually no action is needed. “Duplicate without user-selected canonical” means Google found duplicates and you gave no canonical, so add one to the version you prefer. “Duplicate, Google chose different canonical than user” means you set a canonical and Google overruled it, so find the conflicting signal and fix it.

Do not use the live test for this question. The indexed result is the one that counts: Google states that the canonical can be determined only from indexed data and that the live test cannot predict whether the tested URL will be considered canonical, per canonicaltag.com. The live test still answers a narrower question, whether Google can fetch the page and see the tag, per canonicaltag.com.

After a fix, be patient. Google’s troubleshooting guidance allows up to about two weeks for a changed canonical to be re-evaluated, per canonicaltag.com. An unchanged Google-selected canonical the next morning is not evidence the fix failed.

Step 5: Check the destination

A well-formed tag can still name the wrong page, and no syntax check catches that, per canonicaltag.com. RFC 6596 requires the target to be a duplicate or a superset of the page declaring it, per canonicaltag.com. Request the target with curl and confirm four things: it returns 200 without redirecting; it carries no noindex and is not disallowed in robots.txt, since Google cannot read the tags on a page it is blocked from crawling; its own canonical is itself, so the chain ends there; and it is the URL the sitemap lists, the internal links use, and the hreflang annotations reference, per canonicaltag.com.

Avoid three targets in particular: the source of a permanent redirect, a URL that returns an error code, and a URL that itself canonicalizes somewhere else, per canonicaltag.com. A canonical pointing at a redirect or a 404 should point at the final URL that returns 200, per abacklaunch.com.

Then make the supporting signals agree. Google’s guide lists the signals it weighs, and they are not equal: redirects are a strong signal, a rel=canonical tag is a strong signal, and a sitemap listing is a weak one, per abacklaunch.com, citing Google. Internal links, hreflang annotations and whether the page is served over HTTPS also count, per abacklaunch.com. If the canonical says one thing and the rest of the site says another, Google may ignore the tag and choose for itself, per abacklaunch.com.

If the check shows wider duplicate problems across the site, start with our guide on how to fix duplicate content on WordPress first.

Worked example: this site’s own canonicals

This site’s own live pages show what a healthy setup looks like when you run all three checks. Here are six posts, checked live on 2 Dec 2026 with view source, curl headers, and a parameter test.

Live URL on this site Canonical tags in view source Canonical in HTTP header Words in the slug Characters in the slug
/how-to-do-keyword-research-small-business-website-free/ 1, self-referencing None 9 words 54 characters
/how-to-use-long-tail-keywords-for-small-business-seo/ 1, self-referencing None 10 words 52 characters
/how-to-find-low-competition-keywords-for-a-small-business/ 1, self-referencing None 10 words 57 characters
/how-to-check-keyword-difficulty-for-free/ 1, self-referencing None 7 words 40 characters
/how-to-check-keyword-difficulty-in-bulk/ 1, self-referencing None 7 words 39 characters
/how-to-export-keywords-from-google-search-console/ 1, self-referencing None 8 words 49 characters

Every post carries exactly one self-referencing canonical in its HTML, added by Yoast SEO, and none sends a canonical Link header. That is the expected result on a WordPress site with Yoast: the tag lives in the HTML, and the header carries nothing.

Two extra checks confirm the setup holds together. First, the parameter test: loading the difficulty-free post with ?utm_source=newsletter added to the address still returns a canonical pointing at the clean URL, without the parameter. Second, the host and protocol test: the www version and the http version of the same post both return a 301 redirect to the clean https non-www address, so there is no duplicate host or protocol version for Google to choose between.

The lesson is that a working canonical setup is boring on purpose. All six slugs are 39 to 57 characters, each page’s canonical points at its own full address, and nothing was typed into a Canonical URL field for any of them. The check is worth doing anyway, because a template bug that points every post at the home page can drop whole sections from Google without a single visible error on the site, per abacklaunch.com.

How often should you check your canonicals?

A quarterly pass is enough for most small business sites, but check at the right moments, not just on a calendar.

  • After a publish: check the new page’s source once for its one self-referencing canonical.
  • After a release: check one URL per template after each release, per abacklaunch.com. Home page, a blog post, a product or listing page, and a docs page cover most sites, per abacklaunch.com.
  • After a migration: when you change domain, protocol, or permalink structure, check your most important pages first.
  • After a plugin change: when you switch SEO plugins or themes, check that only one source prints the tag.
  • After a Search Console warning: open URL Inspection and compare the two canonical lines for the flagged page.
  • Every quarter: fold the canonical check into your regular audit. Our guide on how to do an SEO audit for a small business website shows the full routine.

Common mistakes to avoid

Trusting a clean live test as Google’s verdict. Only the indexed URL Inspection result shows the selected canonical, per canonicaltag.com.

Using a site: search as a canonical check. Google documents URL Inspection for this purpose, not search operators, per canonicaltag.com.

Stopping at the first match in view source. Look for another canonical declaration rather than stopping at the first one, per openmultiurl.com. A second tag further down the page is the problem, and the first match hides it.

Treating “no canonical in the source” as “no canonical”. The header may carry it, per canonicaltag.com. Check the header with curl before concluding anything.

Using noindex to steer the canonical choice. Google does not recommend it for preventing canonical selection within a single site, per canonicaltag.com. A page that carries both sends very contradictory information, per canonicaltag.com.

Checking only the destination after a redirect. Note the starting address before opening it, because a redirect might change the browser’s address bar, per openmultiurl.com. If you inspect only the destination, you can miss what happened to the original URL, per openmultiurl.com.

Comparing different kinds of evidence as though they were identical. Label every result by where you found it: original HTML, rendered document, HTTP header, or Google indexed data, per openmultiurl.com. That small note prevents you from comparing a declaration with a decision as if they were the same thing.

Frequently asked questions

How do I find the canonical URL of a page?

Open View Source and search for canonical to find the declared URL in the HTML, and run curl -sI on the page to catch a canonical sent as an HTTP header, per canonicaltag.com. That tells you what the site declares. To see the URL Google treats as canonical, inspect the page in Search Console’s URL Inspection and read the Google-selected canonical in the indexed result, per canonicaltag.com.

Can the URL Inspection live test show the Google-selected canonical?

No. Google states that the canonical version can be determined only from indexed data and that the live test cannot predict it, per canonicaltag.com. Use the live test to confirm Google can fetch the page and see your tag, and the indexed result to see Google’s choice, per canonicaltag.com.

Why does URL Inspection show a different canonical than my tag?

Google treats the tag as a hint and weighs it against other signals such as redirects, internal links and sitemap entries, per canonicaltag.com. When those point elsewhere, or the tag is unreadable because it sits after an invalid head element, Google may select a different URL, per canonicaltag.com.

How do I check a canonical set in the HTTP header?

Request the URL’s headers with curl -sI and look for a Link line ending in rel=”canonical”, per canonicaltag.com. If the HEAD request returns nothing, repeat with curl -s -D - -o /dev/null to see the headers of a real GET, since some servers treat the two differently, per canonicaltag.com.

Why does a canonical checker report no canonical when DevTools shows one?

The canonical is probably added by JavaScript, per canonicaltag.com. Server-side checkers and View Source read the HTML before scripts run, while the DevTools Elements panel shows the DOM after they finish, per canonicaltag.com. Google can process a script-injected canonical during rendering, but a canonical in the server HTML is the more reliable arrangement, per canonicaltag.com.

How long does Google take to reflect a canonical fix?

Google’s troubleshooting guidance allows up to about two weeks for a changed canonical to be re-evaluated, per canonicaltag.com. Check the indexed URL Inspection result after that window rather than the next day, and confirm the fix is visible in the server HTML or header first, per canonicaltag.com.

Conclusion

Checking a canonical URL is three small checks, not one: read what the page declares in view source, check the header with curl, and ask Google what it chose in Search Console. When the declaration, the destination and Google’s choice all name the same address, the page is set. When they disagree, fix the conflicting signal and check the indexed result again.