Skip to content
Tools

Canonical URL Generator

Generate a clean canonical URL tag for your webpage to help search engines understand the preferred URL for duplicate or similar page versions.

An absolute http or https URL. Query strings, fragments and international domains are all handled.

Normalisation

The scheme and host are lowercased, a default port is dropped and anything needing percent-encoding is encoded — none of which can change what the server returns. Everything below is off unless you turn it on, because each one could.

/about and /about/ are different URLs and may be different pages. Only change this if you know which one your server serves.

Enter a page URL to generate its canonical tag.

Everything runs locally in your browser. The URL you enter is never uploaded to our server.

What is a canonical URL?

The URL you would prefer search engines to treat as the address of a piece of content, when the same content answers at more than one.

That happens constantly, and almost never on purpose. A single product page can be reachable at all of these:

One page, five URLs
https://example.com/shoeshttps://example.com/shoes/https://www.example.com/shoeshttps://example.com/shoes?utm_source=newsletterhttps://example.com/category/footwear/shoes

To a search engine those are five URLs that happen to serve identical content. The canonical tag says which one is the real address, and asks for the others to be treated as versions of it.

Why canonical URLs matter

Duplicates are not penalised. They are simply wasteful, in three ways:

  • Signals split. Links, engagement and authority attach to whichever URL was used, so five versions of a page each get a fifth of the credit instead of one page getting all of it.
  • Crawling is wasted. Every duplicate is fetched. On a large site that is crawl budget spent re-reading pages that already exist.
  • The wrong URL can rank. Without a declared preference, search engines pick one — and it might be the version with a tracking parameter stuck to it, which is what then appears in results.

A canonical tag does not add anything to a page. It prevents a page competing with itself, which is a different and more modest claim than most of what is written about it.

How to create a canonical tag

One element, in the head:

The tag
<head>  <!-- … -->  <link rel="canonical" href="https://example.com/blog/post"></head>

Four requirements, all of which the generator above enforces:

  • Absolute. A relative canonical resolves against the current page, so the same value produces a different canonical on every URL — which defeats the point entirely.
  • In the head. A link element in the body is ignored. Check the rendered HTML, not the template — an unclosed tag earlier in the head can push it into the body without anyone noticing.
  • Exactly one. Two canonical elements are worse than none: conflicting hints are discarded rather than resolved.
  • Pointing at a real page. The target should return 200 and be indexable. Canonicalising to a redirect, a 404 or a noindexed page asks for a preference that cannot be honoured.

The tag sits in the head beside the title and description; the meta tag generator writes that block, canonical included, if you are assembling the whole head at once.

For files with no head — a PDF, an image, a feed — the same thing is said with an HTTP header instead:

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

Self-referencing canonicals

A page whose canonical names its own URL. On /about the tag says /about. It looks pointless and is not.

The moment somebody shares that page with a campaign parameter attached, a crawler encounters /about?utm_source=twitter — a URL it has never seen, serving content it already has. The self-referencing canonical on that response says the real address is /about, and the two are consolidated instead of competing.

It is not required. Search engines choose a canonical whether you declare one or not; declaring one removes the guesswork. Putting a self-referencing canonical on every page is a common and defensible default.

Canonical tags and duplicate content

Worth being precise, because this is where most of the confusion lives. A canonical tag asks search engines to consolidate duplicates. It does not:

  • remove anything from the index;
  • stop the duplicate URLs being crawled;
  • guarantee which URL is chosen;
  • protect against anything.

What it does is let signals accumulate on one URL rather than several, so the versions stop dividing the credit between them. If you need a URL out of the index, that is a noindex tag. If it should stop existing, that is a redirect.

A hint, not a command

Google is explicit that rel="canonical" is a hint, not a directive. It weighs the tag against everything else it knows: redirects, internal links, sitemap entries, hreflang, and how similar the pages actually are.

So a canonical can be — and regularly is — overruled. The usual reasons:

  • The pages are not equivalent. Canonicalising a category page to a product page tells search engines something they can see is untrue.
  • Your other signals disagree. If every internal link points at /about/ and the canonical says /about, the links are a louder signal than the tag.
  • The target is unreachable — blocked, redirecting, 404, or noindexed.

Search Console reports the URL Google actually selected, which is the only way to find out whether your hint was taken.

Canonical vs redirect

A comparison of canonical tags and 301 redirects across who is affected, whether both URLs keep working, and when each is the right tool.
Canonical tag301 redirect
Who it affectsSearch engines onlyEveryone — browsers, users, crawlers
The original URLKeeps working and serving contentStops serving; sends you elsewhere
StrengthA hint that can be overruledA directive that is followed
Use it whenBoth URLs must stay reachableThe URL should no longer be used

A canonical is not a substitute for a redirect. If a page has genuinely moved, redirect it — leaving the old URL live means it keeps being crawled and keeps being a URL people can land on. Canonicals are for the cases where both URLs must keep working: filter and pagination variants, printer-friendly versions, the same product under two categories, syndicated copies on another domain.

Canonical vs robots.txt

These are not alternatives and are not interchangeable. robots.txt controls whether a URL may be crawled. A canonical says which of several crawlable URLs is preferred.

Combining them is self-defeating, and it is a common accident. A URL blocked in robots.txt is never fetched — so the canonical tag on it is never read, and the consolidation you were asking for cannot happen. If you want a duplicate consolidated, it has to stay crawlable — worth checking your rules in the robots.txt generator before assuming a canonical will be seen.

The same trap applies to noindex: a page has to be crawled for its noindex tag to be seen. Blocking is for URLs you do not want fetched at all; canonicals and noindex are for URLs you do.

Query parameters and canonicalisation

This is the decision that matters most, and the one where a careless generator does real damage. The question for every parameter is the same: does it change what the server returns?

  • Keep it when it selects content — ?page=2, ?id=17, ?q=shoes, ?variant=blue. Removing these canonicalises page two onto page one, which quietly removes page two from consideration.
  • Remove it when it identifies a campaign or a click — utm_source, gclid, fbclid. These select nothing, so leaving them in means every campaign produces a separately-canonical copy of the same page.
  • Think about it for sorting and display parameters. If ?sort=price shows the same items in a different order, canonicalise to the unsorted version. If it shows different items, it does not.

The generator above keeps every parameter by default and removes tracking ones only when you turn that on — from a list you can read. Here is a messy URL with tracking removal enabled:

Normalised, with tracking removal on
In   HTTPS://Example.COM:443/Blog/Post?utm_source=newsletter&page=2#commentsOut  https://example.com/Blog/Post?page=2 · Scheme lowercased· Host lowercased· Default port removed· Fragment removed· Tracking parameters removed: utm_source  (your option)

Note what survived: page=2. It selects content, so it stays — and the tool lists every change rather than presenting a different URL and hoping you do not check.

HTTPS and canonical URLs

If the site serves HTTPS, the canonical should name the HTTPS URL. Pointing it at the http version tells search engines the insecure URL is the preferred one, which is the opposite of what almost anyone wants.

The one condition: the URL has to actually respond. Canonicalising to https on a host that only serves http names a URL nobody can fetch, and the hint is discarded. That is why the generator leaves the scheme alone unless you ask — it cannot check what your server does, and only you know.

The same logic applies to www. Pick whichever version your server serves, use it in your canonicals, your internal links and your sitemap alike, and ideally redirect the other one to it.

Escaping the URL in the tag

An attribute value is HTML, and in HTML a bare ampersand starts a character reference. A canonical URL routinely contains one:

Wrong, and right
<!-- Wrong: &page is an unterminated character reference --><link rel="canonical" href="https://example.com/s?q=shoes&page=2"> <!-- Right --><link rel="canonical" href="https://example.com/s?q=shoes&amp;page=2">

Both describe the same URL — &amp; is how you write an ampersand in HTML, and a parser turns it back into &. But only the second is valid markup, and a parser following the specification reads the first as a different URL.

Browsers forgive it, which is exactly why it survives: nothing appears broken. It is the most common defect in generated canonical tags, and every tag this tool produces is escaped.

Common canonical mistakes

  • Canonicalising every page to the homepage. The classic catastrophic template bug — it asks for the entire site to be treated as one page.
  • Using a relative URL. It resolves differently on every page, so it names something different each time.
  • Two canonical tags on one page. Usually a theme and a plugin each adding one. Conflicting hints are discarded, so the page ends up declaring nothing.
  • Canonicalising to a blocked or noindexed URL. The target cannot be used, so the hint is ignored and the choice is made without you.
  • Stripping meaningful parameters. Canonicalising ?page=2 to ?page=1 removes page two from consideration.
  • Canonical and internal links disagreeing. If your links say /about/ and your canonical says /about, you have sent two answers.
  • Pointing at http from an https site. Names the insecure URL as preferred.
  • Leaving a fragment in. Harmless but meaningless — fragments never reach the server.
  • Unescaped ampersands. Covered above, and invisible until a validator or a strict parser sees it.
  • Canonicalising paginated pages to page one. Page two is not a duplicate of page one; it has different content, and canonicalising it away can drop its items from the index.

Frequently asked questions

What is a canonical URL?

The URL you would prefer search engines to treat as the address of a piece of content, when the same or near-identical content is reachable at more than one. If a product page answers at /shoes, /shoes?colour=red and /shoes?utm_source=email, the canonical says which of those is the real one.

What is a canonical tag?

A link element in the head of a page naming its canonical URL: `<link rel="canonical" href="https://example.com/page">`. Same idea, delivered as markup. For files with no head — a PDF, an image — the equivalent is an HTTP `Link:` header.

How do I create a canonical URL?

Take the address of the page you want treated as preferred, make it absolute, drop the fragment, and put it in a link element in the head. The generator above does the URL part and shows you exactly what it changed, so nothing is normalised behind your back.

Should canonical URLs be absolute?

Yes. A relative canonical is resolved against the current page, so the same relative value on two URLs produces two different canonicals — which defeats the point. Google explicitly recommends absolute URLs, and this generator only produces them.

Should every page have a canonical tag?

It is a reasonable default, and a self-referencing canonical on every page is common practice. It is not required — Google chooses a canonical whether you declare one or not — but declaring one removes the ambiguity when a page picks up parameters from campaign links or session identifiers.

What is a self-referencing canonical?

A canonical tag pointing at the page's own URL. On /about it names /about. It sounds redundant and is not: the moment someone links to /about?utm_source=newsletter, the crawler sees a page whose canonical says the real address is /about, and the two are consolidated rather than treated as separate pages.

Can canonical tags prevent duplicate content?

They help search engines consolidate duplicates rather than prevent them existing. Signals for the duplicate URLs are generally attributed to the canonical one, so the versions stop competing. What a canonical does not do is remove anything from the index or guarantee which URL is chosen.

Can Google ignore a canonical tag?

Yes, and it regularly does. A canonical is one signal among several — redirects, internal links, sitemap entries, hreflang and the content itself all weigh in. Google is explicit that it treats the tag as a hint, and search engines may choose a different canonical from the one you declared. If the pages are not actually equivalent, or your other signals point somewhere else, expect that to happen and check Search Console to see which URL was selected.

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

A redirect moves everyone — browsers, users, crawlers — to a different URL, and the original stops serving content. A canonical leaves both URLs working and tells search engines which one to prefer. Use a redirect when a URL should no longer be reachable; use a canonical when both must stay reachable but only one should be indexed. A redirect is the stronger signal of the two.

Is a canonical tag a substitute for a redirect?

No. If a page has genuinely moved, redirect it — a canonical leaves the old URL live, serving content, and consuming crawl budget. Canonicals are for URLs that must all keep working, such as filter and pagination variants, printer-friendly versions, or the same product under two categories.

What is the difference between a canonical tag and robots.txt?

They do unrelated jobs. robots.txt controls whether a URL may be *crawled*; a canonical tells search engines which of several crawlable URLs is *preferred*. They are not interchangeable, and combining them backfires: a URL blocked in robots.txt cannot be fetched, so its canonical tag is never read. If you want a duplicate consolidated, it has to stay crawlable.

Should query parameters be included in a canonical URL?

It depends entirely on whether the parameter changes what is served. `?page=2` and `?id=17` select content and must stay — dropping them would canonicalise page two onto page one, which is the most damaging mistake in this area. `?utm_source=email` selects nothing and can go. This generator keeps every parameter by default and removes tracking ones only when you ask.

Should tracking parameters be removed?

Usually yes. A campaign parameter identifies where a click came from, not which page it landed on, so leaving it in means every campaign produces a differently-canonicalised copy of the same page. The generator has a visible, editable list of what it treats as tracking, so the call stays yours.

Should canonical URLs use HTTPS?

If the site serves HTTPS, yes — pointing the canonical at the http version tells search engines the insecure URL is the preferred one. The one condition is that the URL must actually respond: canonicalising to https on a site that only serves http names a URL nobody can fetch.

Can a canonical point to another domain?

Yes. Cross-domain canonicals are the standard way to handle syndicated content — a republished article can canonicalise to the original on the publisher's domain. Both pages must be reachable and genuinely equivalent, and it is worth being deliberate, because it is a request to attribute the content to somebody else's URL.

Can a canonical tag point to a non-indexable page?

It can, and it is almost always a mistake. Canonicalising to a URL that is blocked in robots.txt, tagged noindex, redirecting, or returning a 404 asks search engines to prefer a URL they cannot use — so the hint is discarded and the choice made without you. Point canonicals at URLs that return 200 and are indexable.

Can canonical tags improve SEO?

They can prevent a specific kind of harm rather than add anything. Duplicate URLs split signals between versions and waste crawl budget; consolidating them concentrates both. No canonical tag has ever improved a ranking on its own, and anything promising otherwise is selling something.

What happens if a page has multiple canonical tags?

Google discards conflicting canonical hints rather than picking one, so the page ends up with no declared preference at all — worse than having none. It is a common accident when a theme and a plugin each add one, or when a template adds a tag that a CMS field also fills. Check the rendered HTML, not the template.

Does the canonical tag have to be in the head?

Yes. A link element outside the head is ignored. This trips people up with JavaScript that appends a canonical after page load, or with markup accidentally moved into the body by an unclosed tag earlier in the head.

Do canonical tags work with pagination?

Each page in a series should generally canonicalise to itself, not to page one. Page two is not a duplicate of page one — it has different content — and canonicalising it away can remove its items from the index entirely. If there is a genuine view-all page that contains everything, canonicalising the paginated pages to it is a defensible alternative.

Should the canonical match my internal links?

Yes, and this is the signal people most often forget. If your canonical says /about but every internal link points at /about/, you are sending contradictory signals and search engines may follow the links instead. Pick one form — trailing slash or not, www or not — and use it in your canonicals, your internal links and your sitemap alike.

Is a canonical tag a security or access-control mechanism?

No, in every sense. It is a hint about URL preference visible to anyone who views source. It does not restrict access, hide a page, or prevent anything from being fetched or indexed. Anything that must not be reached needs authentication on the server.

Why does the generator escape ampersands in the URL?

Because an attribute value is HTML, and a bare `&` starts a character reference. In `href="…?q=shoes&page=2"` a strict parser reads `&page` as an unterminated entity. Written correctly it is `&amp;page=2`, which is the same URL and valid markup. Browsers forgive the mistake; validators do not, and it is the most common defect in generated canonical tags.

Does the generator change my URL?

Only in ways that cannot change which page is served, and it lists every one. It drops the fragment, lowercases the scheme and host, removes a default port and percent-encodes anything that needs it. Everything that could alter the page — the query string, the trailing slash, http versus https, www — is left exactly as you typed it unless you switch that option on.

What is a fragment, and why is it removed?

The part after the # — `#pricing` in /plans#pricing. Fragments are never sent to the server, so two URLs differing only by fragment are the same page as far as any crawler is concerned. A canonical containing one is at best noise, so it is dropped by default. You can turn that off.

How should I handle www and non-www?

Pick one and be consistent everywhere — canonical, internal links, sitemap. The generator will strip a leading www. if you ask it to, but it will not do so by default, because the version to keep is the one your server actually serves and only you know which that is. Ideally the other version redirects to it as well.

Is this generator free?

Yes. The generator, the normalisation options, the validation and the copy actions are free, with no account and no limit.

Is my URL uploaded?

No. Everything runs locally in your browser — the URL is parsed, normalised and turned into markup on your own machine, and nothing you type is sent to our server. There is no account and nothing is stored.

Can I copy the generated tag?

Yes, with one click, and the copy confirms. You can also copy the canonical URL on its own, the HTTP `Link:` header form for non-HTML files, or a head snippet ready to paste into a template.

Popular tools

↑ ↓NavigateOpenEscClose