What a canonical tag does and why you need one
A canonical tag is a single line of HTML that tells search engines which version of a page is the "official" one when you have multiple URLs pointing to the same content. It lives in the <head> section of your HTML and looks like this:
<link rel="canonical" href="https://example.com/your-page" />
Without it, search engines may index duplicate versions of the same page — say, one with ?utm_source=email at the end and one without. That splits your search ranking power across multiple URLs instead of concentrating it on one. A canonical tag consolidates that ranking to the URL you choose.
You need one when you have intentional duplicates (like a mobile version and a desktop version at different URLs), when URL parameters create variations of the same page, or when you republish content from another site and want to credit the original.
Key Takeaways
- Place the canonical tag in the <head> section of your HTML, not in the body, and use the full absolute URL (starting with https://) not a relative path.
- Point the canonical tag to the version you want search engines to rank — usually the version without tracking parameters or session IDs.
- Use a canonical tag on every page of your site, even pages that are not duplicates, to prevent search engines from creating their own versions.
- If you republish someone else's content, point the canonical tag to the original source so search engines know you are not claiming to be first.
Where to place the canonical tag in your HTML
The canonical tag belongs in the <head> section, between the opening <head> tag and the closing </head> tag. It should come after your <title> tag and your meta tags for description and viewport, but the exact order does not matter to search engines.
Here is what a real <head> section looks like with a canonical tag included:
<head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>How to Add a Canonical Tag</title> <meta name="description" content="Learn where to place canonical tags in HTML"> <link rel="canonical" href="https://example.com/canonical-tags" /> </head>
Never put the canonical tag in the body of your page or in a comment. Search engines only read the <head> section for this instruction.
Using absolute URLs, not relative paths
Always use the full URL starting with https:// or http://, not a relative path. This is called an absolute URL. Write https://example.com/page, not /page.
Search engines need the complete address to know which site you are pointing to. A relative path works fine for links in your HTML body, but canonical tags require the full address so there is no ambiguity.
If your site uses HTTPS (which it should), make sure your canonical tag uses HTTPS as well. Mixing HTTP and HTTPS in canonical tags can confuse search engines about which version is official.
Pointing the canonical tag to the right version
Choose the version of the page you want search engines to rank and send traffic to. Usually that is the version without tracking parameters, session IDs, or sorting options.
For example, if you have these three URLs all showing the same product:
- https://example.com/product/shoes
- https://example.com/product/shoes?utm_source=email
- https://example.com/product/shoes?sort=price
Put the canonical tag on all three pages, but point each one to https://example.com/product/shoes — the clean version without parameters. This tells search engines to treat all three as the same page and rank only the clean version.
You can also point a page to itself. If you have a page with no duplicates, the canonical tag can point to its own URL. This prevents search engines from accidentally creating their own versions of the page with different parameters.
Canonical tags for republished or syndicated content
If you publish an article that originally appeared on another website, use a canonical tag to point to the original source. This tells search engines you are not claiming to be the first publisher and helps the original site keep its search ranking.
For example, if you republish a guest post that first appeared on another blog, add this to your version:
<link rel="canonical" href="https://originalblog.com/guest-post-title" />
This is common in news sites, content networks, and sites that republish with permission. Without it, search engines may rank your version higher than the original, which is unfair to the author and can hurt your own credibility if search engines detect the duplication.
Common mistakes to avoid
Do not use relative URLs in canonical tags. <link rel="canonical" href="/page" /> will not work reliably. Always include the full domain.
Do not point a canonical tag to a different page and expect them to merge in search results. A canonical tag tells search engines which version is official, but it does not combine two different pages into one ranking. If you have two pages about different topics, they should not share a canonical tag.
Do not use canonical tags to hide duplicate content from search engines. Search engines still crawl all your pages. A canonical tag is a signal about which version to rank, not a way to prevent indexing. If you truly do not want a page indexed, use a robots.txt file or a noindex meta tag instead.
Do not create a chain of canonical tags. Page A should not point to Page B, and Page B should not point to Page C. Each page should point directly to the version you want ranked. Chains confuse search engines and may not work as intended.
Testing your canonical tag
After you add a canonical tag, check that it is working by viewing the page source in your browser. Right-click on the page, select "View Page Source," and search for the word "canonical." You should see your tag in the <head> section with the correct URL.
You can also use Google Search Console to see how Google interprets your canonical tags. Log in to Search Console, go to the page in question, and look at the "Canonical URL" field under the page details. Google will show you which canonical tag it found and which version it is using for ranking.
If you see a different URL than the one you specified, Google may have detected a conflict — for example, a canonical tag pointing to a page that does not exist, or multiple conflicting canonical tags on the same page. Fix the URL and recheck after a few days.
Frequently Asked Questions
Can I use a canonical tag to redirect traffic from one page to another?
No. A canonical tag tells search engines which version to rank, but it does not redirect visitors. If you want to send traffic from one URL to another, use a 301 redirect instead. A canonical tag is for search engines; a redirect is for browsers.
What happens if I point a canonical tag to a page that does not exist?
Search engines will ignore the canonical tag and may index the page you are on instead. Always make sure the URL in your canonical tag actually exists and returns a 200 status code (meaning the page loaded successfully).
Do I need a canonical tag on every page of my site?
It is a good practice to add a canonical tag to every page, even if you do not think you have duplicates. Pointing each page to itself prevents search engines from accidentally creating their own versions with different parameters or protocols.
Can I use a canonical tag to point to a page on a different website?
Yes, but use it carefully. This is mainly for republished or syndicated content. If you point your page to someone else's site, search engines will rank their version instead of yours, so use this only when you want to credit the original source.
What is the difference between a canonical tag and a noindex tag?
A canonical tag tells search engines which version of a duplicate page to rank. A noindex tag tells search engines not to index a page at all. Use canonical tags for duplicates you want to keep; use noindex for pages you want hidden from search results.