Skip to content
ToolHub

Canonical Tag Generator

Create a rel="canonical" tag, optionally with matching hreflang tags.

๐Ÿ” SEO Tools Free ยท No sign-up Part of SEO Toolkit
๐Ÿ”
SEOTools Pro
SEO Tools & Generators
๐Ÿ” Result
โ€”
โ€”
History 0
๐Ÿ“‹
No activity yet
Your history will appear here

About the Canonical Tag Generator

A canonical tag tells search engines which URL is the main version of a page when the same content is available at several addresses, for example with tracking parameters, with and without a trailing slash, or on printer-friendly versions.

Enter the preferred URL to get the <link rel="canonical"> tag. The tool also checks whether the URL uses HTTPS and can add English and x-default hreflang tags for single-language sites.

How to use the Canonical Tag Generator

  1. Enter the full preferred URL, including https://.
  2. Choose whether to include hreflang tags.
  3. Copy the tag into the <head> of every duplicate version, and of the main page itself.

Example

Parameter duplicates

/shoes?utm_source=newsletter and /shoes?sort=price can both point to <link rel="canonical" href="https://example.com/shoes">.

Why duplicate URLs happen

Search engines identify a page by its URL, not by its content. If the same content answers at several addresses, they have to guess which one to list, and signals such as links can be split between the copies. Duplicates are usually accidental: tracking parameters (?utm_source=), sort and filter options, http versus https, www versus the bare domain, a trailing slash or none, and print-friendly versions.

A canonical tag is the pageโ€™s own statement of โ€œthis is the address I want listedโ€. Google treats it as a strong hint rather than an order, and it can choose another URL if your signals contradict each other, for example when the canonical points at a page that redirects elsewhere.

What the generator produces

Enter the preferred URL and the tool outputs one line:

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

If you choose โ€œYes (English)โ€ for hreflang, it adds two more lines, an alternate link with hreflang="en" and one with hreflang="x-default", both pointing at the same URL. That is only right for a site with a single language version. A multilingual site needs one alternate line per language, so build those with the Hreflang Tag Generator instead.

Below the tag you will see the URLโ€™s length, its domain and whether it uses HTTPS. A โ€œNoโ€ in the HTTPS box is the quickest way to spot a canonical that still points at an old http:// address.

Rules that avoid common mistakes

  • Use the full, absolute URL, including https:// and the domain. Relative paths are easy to get wrong.
  • One canonical per page, placed in the <head>. Tags in the body are ignored.
  • Point to a page that works: it should return a normal 200 response, be indexable and not redirect.
  • Be consistent with your sitemap, internal links and redirects. They should all name the same preferred URL.
  • Do not canonicalise different content together. Page 2 of a list is not a duplicate of page 1.

Examples

Tracking parameters

A newsletter links to https://example.com/shoes?utm_source=newsletter&utm_campaign=may. The pageโ€™s tag says https://example.com/shoes, so every campaign link consolidates into one listing.

Both protocol and host

If your site is reachable at http://www.example.com/about and https://example.com/about, choose the HTTPS, no-www address as preferred and put that single tag on the page. Back it up with a 301 redirect from the other versions.

Syndicated article

You republish a guest article that first appeared on another site. Pointing your canonical at the original tells search engines which version to credit.

Frequently asked questions

Should a page have a self-referencing canonical?

Yes, it is a common best practice: it protects against duplicates created by parameters you do not control.

Is canonical a redirect?

No. It is a strong hint, not a command. Visitors stay on the URL they opened; use a 301 redirect if the old URL should not be used at all.

Can the canonical point to another domain?

Yes, for syndicated content you can point to the original article on another domain.

What is the difference between a canonical tag and a 301 redirect?

A redirect sends visitors and crawlers to the new URL. A canonical tag leaves the duplicate reachable and only suggests which version to index. Use a redirect when the old URL should disappear, and a canonical when both URLs need to keep working.

Where does the canonical tag go?

In the <head> of the HTML, on the duplicate pages and on the preferred page itself. Search engines ignore it if it appears in the body.

Can I use a relative URL in the canonical tag?

It can work, but absolute URLs are safer because a relative path can resolve to the wrong address. This generator expects the full URL.

Should the canonical be on pages I do not want indexed?

Do not mix signals. If a page should stay out of search results, use a noindex directive. A canonical pointing to a different page asks search engines to treat it as a copy, which is a different instruction.

Does a canonical tag work for PDFs and other non-HTML files?

Not through a tag, because those files have no head. For them, the canonical is sent as an HTTP response header, which is set on your server.

Will Google always follow my canonical?

Not always. It is a hint, and Google weighs it against redirects, internal links, sitemaps and the content itself. Keeping all of them pointing at the same URL gives it the best chance of being respected.

Use โ†‘ โ†“ to move, Enter to open.