Canonical Tag Generator

Generate valid rel="canonical" tags with URL validation, issue detection, and code snippets for every major framework.

0
Issues
Status
✓ Clean
✓ URL looks clean — no issues detected
Self-referencing canonical (recommended)

Quick examples

Relevant tools

Browse all →

More SEO and webmaster tools.

What Is a Canonical Tag?

A canonical tag — formally <link rel="canonical" href="..." /> — is an HTML element that tells search engines which version of a URL is the master copy. Introduced by Google, Yahoo, and Bing in 2009, it solves one of the most common SEO problems: duplicate content.

In the real world, the same page content often exists at multiple URLs. Consider these variations that all show the same page: example.com/shoes, example.com/shoes/, www.example.com/shoes, example.com/shoes?color=blue&sort=price. Without a canonical tag, search engines must guess which one to index — and they often guess wrong, splitting your ranking power across multiple URLs.

The canonical tag consolidates all ranking signals (backlinks, social shares, engagement metrics) to a single preferred URL. Google's official documentation calls this "URL canonicalization" and recommends it as a core SEO practice for every website.

Common Canonical Tag Mistakes

Using Relative URLs

✕ <link rel="canonical" href="/page" />
✓ <link rel="canonical" href="https://example.com/page" />

Always use absolute URLs with the full protocol and domain. Relative URLs can be misinterpreted.

Canonicalizing to a 404 or Redirect

The canonical URL must return a 200 status code. Pointing to a page that 404s or 301-redirects sends conflicting signals and wastes crawl budget.

Multiple Canonical Tags

A page should have exactly one canonical tag. If multiple are present (e.g., hardcoded + plugin-generated), Google may ignore all of them. Audit your HTML to ensure only one exists.

Placing in the <body>

Canonical tags must be in the <head> section. Tags in the <body> are silently ignored by all search engines. JavaScript-rendered canonicals may also be unreliable.

Canonical Tags vs Other SEO Directives

MethodTypeUse CaseStrength
Canonical tagHintPreferred URL versionStrong signal
301 redirectDirectivePermanently moved pageStrongest
noindex metaDirectiveRemove from index entirelyDefinitive
robots.txt disallowDirectiveBlock crawlingBlocks crawl only
hreflangSignalLanguage/region variantsComplementary

The canonical tag is a "hint" — Google may choose to ignore it if other signals conflict. 301 redirects are the strongest method but remove access to the original URL.

Canonical Tag Best Practices

  1. Use self-referencing canonicals on every page. Even pages without duplicates should have a canonical pointing to themselves. This protects against unexpected URL parameter additions (analytics, affiliate codes, etc.) and is explicitly recommended by Google.
  2. Always use absolute URLs. Include the full protocol (https://), domain, and path. Never use relative URLs like "/page" — while browsers can resolve them, it's ambiguous for crawlers.
  3. Choose one URL format and stick to it. Pick HTTPS or HTTP, www or non-www, trailing slash or no trailing slash. Set up 301 redirects for the non-preferred versions AND use canonical tags as a backup signal.
  4. Don't canonical to substantially different content. Canonical tags should only point between pages with very similar or identical content. Google will ignore canonicals between obviously different pages and may lose trust in your canonicals overall.
  5. Audit canonicals regularly. Use tools like Google Search Console's "URL Inspection" to verify Google is respecting your canonical declarations. The "Google-selected canonical" field shows what Google actually chose.
  6. Coordinate with hreflang tags. If you have multi-language pages with hreflang annotations, each language variant should have a self-referencing canonical. Don't canonical all language versions to a single URL.

How Search Engines Handle Canonicals

Google, Bing, and other search engines treat the canonical tag as a strong hint, not an absolute directive. This means they usually follow it, but may override your canonical if they believe a different URL is more appropriate. Common reasons for overriding include:

  • The canonical URL returns a 4xx or 5xx error
  • The canonical URL is blocked by robots.txt or has a noindex tag
  • The canonical creates a chain or loop (A → B → C → A)
  • The content at the canonical URL is substantially different
  • Internal links and sitemaps point to a different URL than the canonical
  • Other signals (backlinks, traffic) overwhelmingly favor a different URL

To maximize the chance that Google respects your canonical: ensure the canonical URL is crawlable, indexable, returns 200, and is consistent with your internal linking and sitemap. Use Google Search Console's URL Inspection tool to verify the "Google-selected canonical" matches your declared canonical.

Frequently Asked Questions

What is a canonical tag?

A canonical tag (rel="canonical") is an HTML element placed in the <head> of a webpage that tells search engines which URL is the "preferred" or "master" version of a page. It's used to prevent duplicate content issues when the same or very similar content is accessible through multiple URLs. For example, example.com/page and example.com/page?ref=twitter might show identical content — the canonical tag tells Google which one to index and rank.

When should I use canonical tags?

Use canonical tags when: (1) The same content exists on multiple URLs (www vs non-www, HTTP vs HTTPS, with/without trailing slashes), (2) Product pages accessible through multiple category paths, (3) Pages with URL parameters that don't change content (sorting, tracking, session IDs), (4) Syndicated content published on other sites, (5) Mobile/AMP versions of pages. Google recommends using self-referencing canonicals on every page as a best practice.

Should every page have a canonical tag?

Yes. Google recommends that every page have a self-referencing canonical tag — one that points to its own URL. This reinforces to search engines that the current URL is the preferred version. Even if no duplicate exists today, a self-referencing canonical protects against future duplicate content issues from URL parameters, session IDs, or content syndication.

What's the difference between canonical tags and 301 redirects?

A 301 redirect physically sends users and search engines to a different URL — the old URL becomes inaccessible. A canonical tag keeps both URLs accessible to users but tells search engines to consolidate ranking signals to the canonical URL. Use 301s when you've permanently moved content; use canonicals when you need both URLs to work but want one to be the 'primary' version in search results.

Can canonical tags point to a different domain?

Yes, canonical tags can point to URLs on a different domain (cross-domain canonicals). This is useful for syndicated content — if you republish your article on Medium or LinkedIn, those pages can include a canonical tag pointing back to your original URL. However, Google treats cross-domain canonicals as a hint rather than a directive, so they may not always be followed.

Privacy and Performance

All tag generation and URL validation happens entirely in your browser — no URLs are sent to any server. The tool validates URL format, detects common issues (missing protocol, fragments, uppercase paths, query parameters, index files), and generates implementation code for 8 popular frameworks. Results update instantly as you type.

Tool Vault — Canonical Tag Generator 2026. Fast, private, and mobile-friendly.