Skip to content
MrKeyword
Technical SEO

Canonical tags explained: rel=canonical examples and common mistakes

A canonical tag tells search engines which URL you prefer when the same content appears at more than one address. This guide explains what rel=canonical does, shows HTML and HTTP header examples, covers self-referencing canonicals and cross-domain syndication, lists the mistakes that break consolidation, and links to free checks.

A website analytics dashboard on a desktop monitor
The short version
  • A canonical tag is a strong hint about which URL you prefer among duplicates; Google may still pick a different URL if other signals disagree.
  • Use one absolute URL in <link rel="canonical"> in HTML, or the same URL in an HTTP Link header for PDFs and other non-HTML files.
  • A self-referencing canonical on every indexable URL confirms that URL as the preferred version, even when no duplicate exists.
  • Point canonicals at the final 200 URL: not a redirect, 404, noindex page or relative path.
  • Check live pages with the free indexability checker, which reports the canonical Google would see.

What does a canonical tag do?

A canonical tag tells search engines which URL you prefer when similar or duplicate content appears at more than one address; it is a strong hint, not a guaranteed directive.

Google uses the signal with other clues (redirects, internal links, sitemaps and hreflang) to choose one URL to show in search and to combine ranking signals. It does not remove duplicate URLs from the web, and Google may ignore a canonical when the target is unreachable or conflicts with stronger signals. See Google's guidance on consolidating duplicate URLs.

rel=canonical examples: HTML and HTTP Link header

Put a single absolute URL in a <link rel="canonical" href="..."> tag in the HTML head, or send the same URL in an HTTP Link header for non-HTML files like PDFs.

HTML link tag

Add this inside <head> on the page you are viewing. Use the exact URL you want indexed, including https://, host, path and trailing slash if that is your standard.

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

HTTP Link header for a PDF

A PDF has no HTML head. Configure the server to send a Link header on the PDF response:

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

Google documents both methods in its duplicate URL consolidation guide. Pick one canonical URL per document and keep it consistent across HTML, headers and internal links.

What is a self-referencing canonical?

A self-referencing canonical points to the same URL as the page being viewed, confirming that address as the preferred version.

On https://example.com/guide/, the canonical href is also https://example.com/guide/. Even when you have no obvious duplicate, a self canonical is good practice on indexable templates: it sets a clear preferred URL if parameters, tracking IDs or alternate hosts appear later. It also makes automated checks simple: the indexability checker expects indexable pages to canonicalize to themselves unless you intentionally consolidate elsewhere.

When should you use a canonical tag?

Use a canonical when the same or very similar content is reachable at more than one URL and you want search engines to treat one URL as primary.

  • URL parameters. Sort, filter, session or tracking parameters can create many URLs for one product or article. Canonicalize to the clean URL without parameters, or to the parameter set you want indexed, and keep internal links aligned with that choice.
  • HTTP vs HTTPS and www variants. If both http://example.com/page and https://www.example.com/page return 200, pick one HTTPS preferred host and canonicalize every variant to it. Redirects are stronger; canonicals help when redirects are incomplete.
  • Trailing slash and casing. /guide and /guide/ are different URLs to crawlers. Standardize redirects and canonicals on one form.
  • Syndicated or cross-domain content. When you republish an article on a partner site, the syndicated copy can use a cross-domain canonical to the original on example.com so Google attributes signals to the source. Both sites must agree on which URL is primary; the original should not canonicalize to the syndicated copy.

Common canonical tag mistakes

The mistakes that break consolidation are wrong targets, relative URLs, multiple tags and signals that disagree with hreflang or your sitemap.

Canonical troubleshooting

MistakeWhy it failsFix
Canonical to a redirectThe target is not the final URL Google should index.Point the canonical at the final 200 URL after redirects, or redirect the duplicate directly.
Canonical to a 404 or soft 404Google cannot consolidate to a missing page.Fix the target or remove the canonical until the preferred URL exists.
Canonical to a noindex pageYou ask Google to prefer a URL you also block from indexing.Remove noindex from the preferred URL, or choose a different canonical that is indexable.
Relative URL in href/guide/ is ambiguous across hosts and schemes.Use an absolute URL with scheme and host: https://example.com/guide/.
Several canonical tagsCrawlers see conflicting preferred URLs.Emit exactly one canonical per HTML response or one Link header value.
Every paginated page canonicalizes to page 1Google may treat pages 2+ as duplicates of page 1 and drop them from search.Each page in a series should self-reference, or use rel="next" / rel="prev" where appropriate; do not point all pages at page 1 unless they are true duplicates.
Canonical conflicts with hreflang or sitemapLanguage alternates or sitemap entries point at URLs the canonical rejects.Align hreflang targets, sitemap <loc> values and canonicals on the same preferred URL per language. See hreflang tags explained.

Google's canonicalization troubleshooting walks through why a chosen canonical might be ignored and how to inspect the result in Search Console.

How to check canonical tags on a live URL

Start with the free indexability checker, which reads the canonical from HTML or headers and flags targets that look wrong.

  1. Run the indexability checker

    Paste the URL. The report includes a Canonical row with the href Google would see, plus robots, redirects and noindex signals. A canonical to another URL marks the page as at risk rather than directly blocked.

  2. Follow redirects on the canonical target

    If the canonical points elsewhere, use the redirect checker on both the page URL and the canonical target to confirm the final address returns 200.

  3. Read related guides when indexing stalls

    When Search Console shows Crawled - currently not indexed, a wrong canonical is a common cause. For header-based noindex on PDFs, see X-Robots-Tag explained. For language versions, keep canonical and hreflang aligned using the hreflang guide.

Re-check after template or CDN changes. A correct value in your CMS only helps when the live response actually sends it.

Questions and answers

Canonical tags questions

What is a canonical tag?

A canonical tag is a link element, usually in the HTML head, that names the preferred URL when similar content exists at more than one address.

Is rel=canonical a directive?

No. Google treats it as a strong hint. It may choose a different canonical URL if redirects, internal links or other signals disagree.

What is a self-referencing canonical?

It is a canonical tag whose href is the same URL as the page being viewed, confirming that URL as the preferred version.

Can I use a canonical across domains?

Yes. A syndicated article on another host can canonicalize to the original URL on example.com when both sites agree on which copy is primary.

Should every page have a canonical tag?

Indexable pages should have exactly one canonical, usually self-referencing unless you intentionally consolidate duplicates to another URL.

How do I check my canonical tag?

Use the free indexability checker on the live URL. It reports the canonical href along with indexing blockers and redirect chains.

About this article

Written by the MrKeyword team, who build an SEO workspace on first-party Search Console and Bing data. Outside facts link to their original source below. We update this page when the product or the sources change.

Sources

  1. Consolidate duplicate URLs — Google Search Central: canonical link tags, HTTP headers and how Google picks a canonical
  2. Canonicalization troubleshooting — Google Search Central: why Google might ignore a canonical and how to debug it
Keep reading

More on technical SEO, plus the feature and free tool for the same job. All technical SEO guides →

Check your canonical tags on live URLs.

Use the free indexability checker to read the canonical href, then fix templates so every duplicate points at the URL you want in search. Free plan for one website, no card; paid plans from $10 a month.