Canonical Tag

Canonical Tag Generator

Fix duplicate content and consolidate link equity with canonical tags

Configure Tags

0/60 characters

0/160 characters

Generated Code

<meta name="robots" content="index, follow">
<meta property="og:type" content="website">
<meta name="twitter:card" content="summary_large_image">
<meta name="theme-color" content="#000000">
<meta name="viewport" content="width=device-width, initial-scale=1">

πŸ’‘ Tip: Copy these tags and paste them inside the <head> section of your HTML document.

Other Meta Tag Generators

About Canonical Tag Generator

Canonical tags solve one of the most pervasive technical SEO problems β€” duplicate content. When the same or very similar content appears at multiple URLs, search engines must decide which version to index and rank. Without canonical tags guiding this decision, search engines may index the wrong version, split link equity across multiple URLs, or deprioritise all versions of the content.

The rel=canonical link element tells search engines: this is the definitive version of this content. It's a signal, not a directive β€” search engines generally respect it, but can override it if they detect inconsistencies. Despite this nuance, canonical tags are one of the most powerful tools in technical SEO, directly affecting which version of your content ranks and how link equity flows across your site.

Canonical tags are needed more often than most site owners realise. URL parameters for tracking, filtering, and sessions all create duplicate URLs. HTTP and HTTPS versions, www and non-www variants, trailing slash differences β€” all of these create duplicate content scenarios that canonical tags resolve.

When and Why to Use Canonical Tags

Canonical tags serve several distinct use cases beyond simple duplicate content. For e-commerce sites, product pages with colour or size variants often have separate URLs with nearly identical content β€” canonicals consolidate their link equity to the main product page. For content syndication, when your articles are republished on other sites, canonical tags on the syndicated copies point back to your original, preserving your ranking credit.

Self-referential canonicals β€” pointing to the page's own URL β€” are a best practice even when there's no obvious duplication. They pre-emptively signal the canonical URL to search engines, preventing confusion if the page is later accessed via URL variants. Google recommends self-referential canonicals on all pages.

Canonical tags work across domains, not just within a single site. A page on partnersite.com can have a canonical pointing to yoursite.com, telling Google that your site hosts the original content and should receive the ranking credit.

Key Considerations

Always Use Absolute URLs

Canonical tags must use absolute URLs including the full protocol and domain (https://www.example.com/page). Relative URLs can be misinterpreted and create unintended canonicalization. Always use the exact canonical URL including whether it uses www or non-www, and with or without trailing slash β€” consistently matching your canonical URL structure.

Canonical vs 301 Redirect

Canonical tags are for content that legitimately exists at multiple URLs. 301 redirects are for permanently moving content. If you're removing a URL entirely, use a 301 redirect. If the URL needs to remain accessible but a different URL should rank, use canonical. Using canonical when you should 301 redirect leaves duplicate URLs unnecessarily accessible.

Consistency Across Signals

Canonical tags work best when consistent with other signals. Your sitemap should list canonical URLs, internal links should point to canonical URLs, and hreflang tags should reference canonical URLs. Conflicting signals weaken the canonical directive and can cause Google to choose a different canonical than intended.

Avoid Canonical Chains

A canonical chain occurs when Page A canonicals to Page B, which canonicals to Page C. Search engines may not follow chains correctly. Always point canonical tags directly to the final canonical URL β€” never to an intermediate URL that itself has a canonical tag pointing elsewhere.

Common Canonical Tag Issues

Implementation Errors

  • β€’Using relative URLs instead of absolute URLs in canonical tags
  • β€’Canonical tag placed in body instead of head β€” search engines ignore it
  • β€’Multiple canonical tags on the same page β€” search engines may ignore both
  • β€’Canonical chains where canonicals point to pages with other canonicals

Wrong Canonical URL

  • β€’Canonical pointing to HTTP when site is HTTPS
  • β€’www and non-www inconsistency in canonical URLs
  • β€’Trailing slash inconsistency across canonical tags
  • β€’Pagination canonical on page 2 pointing to page 1 instead of self-referential

Missing Canonicals

  • β€’URL parameter pages without canonical tags
  • β€’Paginated content without canonicals allowing all pages to compete
  • β€’Syndicated content without canonicals losing ranking credit to republishers
  • β€’Session ID URL variants indexed without canonical consolidation

Implementation Guide

Canonical Tag HTML Syntax

Correct canonical tag placement and format for common scenarios:

<head>
  <!-- Self-referential canonical (recommended on all pages) -->
  <link rel="canonical" href="https://www.example.com/your-page" />

  <!-- URL parameter page β€” canonical to clean URL -->
  <!-- Current URL: /products?color=red&sort=price -->
  <link rel="canonical" href="https://www.example.com/products" />

  <!-- Syndicated content pointing to original -->
  <link rel="canonical" href="https://www.originalsite.com/original-article" />

  <!-- Product variant pointing to main product page -->
  <!-- Current URL: /product/widget-blue -->
  <link rel="canonical" href="https://www.example.com/product/widget" />
</head>

Next.js 15 Canonical Tags

Generate canonical tags using Next.js metadata alternates:

// app/your-page/page.tsx
// Static canonical
export const metadata = {
  alternates: {
    canonical: "https://yourdomain.com/your-page",
  },
};

// Dynamic canonical for pages with URL params
export async function generateMetadata({ params, searchParams }) {
  // Always canonical to clean URL without params
  return {
    alternates: {
      canonical: `https://yourdomain.com/${params.slug}`,
    },
  };
}

// E-commerce product variants:
// /products/shirt?color=blue β†’ canonical to /products/shirt
export async function generateMetadataForVariant({ params }) {
  return {
    alternates: {
      canonical: `https://yourdomain.com/products/${params.slug}`,
    },
  };
}

Audit Canonical Consistency

Check canonical consistency between your sitemap and page tags:

// Common inconsistencies to check:

// Correct β€” all signals point to same canonical
// Sitemap:        https://www.example.com/page
// Canonical tag:  https://www.example.com/page
// Internal links: https://www.example.com/page

// Wrong β€” www inconsistency
// Sitemap:       https://www.example.com/page
// Canonical tag: https://example.com/page  ← missing www

// Wrong β€” trailing slash inconsistency
// Sitemap:       https://www.example.com/page/
// Canonical tag: https://www.example.com/page  ← no slash

// Use GSC URL Inspection to verify which canonical
// Google has selected for any given page

Common Use Cases

  • Consolidating link equity from URL parameter variants
  • Handling e-commerce product variants that share content
  • Managing syndicated content to preserve original ranking credit
  • Fixing HTTP/HTTPS and www/non-www duplicate content
  • Preventing paginated pages from competing with each other

Pro Tip

Use Google Search Console's URL Inspection tool to check which canonical Google has selected for your pages. If Google shows a different canonical than your declared one, it means Google found conflicting signals. Investigate your internal linking, sitemap, and redirect patterns β€” one of them is pointing to a different URL than your canonical tag.

Frequently Asked Questions

Does Google always respect my canonical tag?+
No β€” canonical tags are signals, not directives. Google can override them when it detects conflicting signals. If your sitemap lists a different URL, your internal links consistently point elsewhere, or your page has redirects to a different URL, Google may select a different canonical. Ensure all signals consistently point to the same URL for maximum effectiveness.
Should every page on my site have a canonical tag?+
Yes, as a best practice. Self-referential canonical tags on every page pre-emptively prevent duplicate content confusion. Google recommends this approach. In Next.js, you can set canonical in your root layout or generateMetadata to ensure every page has one automatically.
What is the difference between a canonical tag and a 301 redirect?+
A canonical tag keeps both URLs accessible while telling search engines which to prefer. A 301 redirect permanently moves traffic and link equity from one URL to another β€” the old URL stops working. Use canonical when you need both URLs accessible. Use 301 when you're permanently retiring a URL.
Can canonical tags hurt my SEO?+
Yes, if misconfigured. A canonical pointing to the wrong URL consolidates your ranking signals away from your intended page. Canonical chains can cause search engines to select an unexpected canonical. Always verify canonical tags after implementation using Google Search Console's URL Inspection tool.
Do canonical tags pass link equity?+
Yes. Link equity from links to non-canonical URLs is consolidated to the canonical version. This is one of the primary SEO benefits β€” instead of having link equity fragmented across URL variants, it all flows to the canonical, potentially improving its ranking strength.