Tell search engines which version of a page is the main one. Enter a URL, choose your preferences, and get a ready-to-use canonical tag as an HTML link, an HTTP header, or a WordPress snippet. It runs in your browser, so nothing you enter is stored.
Canonical Tag Generator
Create a clean canonical tag for any URL as HTML, an HTTP header, or a WordPress snippet.
Input Section
Result Section
Insights / Tips
- Use one canonical URL per page and make sure it returns a 200 status.
- Point filtered, sorted or tracking URLs to the clean version of the page.
- Canonical tags are a hint to search engines, so keep your internal links consistent with them.
Internal Links
What this tool does
- Cleans the URL: removes the #fragment and, if you choose, tracking parameters such as utm_source, gclid and fbclid.
- Sets one preferred version: force HTTPS, use or remove www, and add or remove the trailing slash.
- Three output formats: an HTML
<link rel="canonical">tag, an HTTPLinkheader, or a WordPress PHP snippet. - Safe output: special characters are escaped so the code can be pasted straight into your site.
How to use the canonical tag generator
- Paste the page URL you want search engines to treat as the main version.
- Choose your www and trailing slash preference. Pick the same style your site already uses.
- Keep Remove tracking parameters on unless the parameters change the page content.
- Select an output format and click Generate Canonical Tag.
- Click Copy Output and add the code to your site.
Where to put the canonical tag
- HTML tag: place it inside the
<head>of the page. - HTTP header: use this for PDFs and other files that have no HTML head. Add it in your server or CDN settings.
- WordPress snippet: add it to a Code Snippets plugin or your child theme’s functions.php. It replaces the default WordPress canonical tag. If you use an SEO plugin such as Yoast or Rank Math, set the canonical inside the plugin instead, so two tags are not printed.
When to use a canonical tag
- The same page opens at several URLs (with and without www, http and https, or with a trailing slash).
- Tracking, sorting or filter parameters create duplicate versions of a page.
- You publish the same content on more than one page and want one to rank.
Frequently asked questions
What is a canonical tag?
A canonical tag is a line of code that tells search engines the preferred URL for a page when similar or duplicate versions exist.
Does every page need a canonical tag?
It is good practice. A self-referencing canonical, where the page points to itself, protects you from duplicate URLs created by parameters.
Should the canonical URL include the trailing slash?
Use whichever version your site redirects to. What matters is being consistent across your canonical tags, internal links and sitemap.
Can I use more than one canonical tag on a page?
No. Use exactly one. Multiple tags can cause search engines to ignore them.
Is a canonical tag the same as a 301 redirect?
No. A redirect sends visitors to a different URL. A canonical tag only suggests the preferred URL to search engines while visitors stay on the page.
Should I remove query parameters?
Remove tracking parameters. Keep parameters that change the content of the page, such as a product ID or page number.
