Canonical Tag Generator

Generate a rel="canonical" link tag from any page URL. Free tool that escapes reserved characters and validates the URL scheme.

Independently verified for accuracy

Calculator by Toolsloft ↗

Paste the preferred address for a page and get the canonical link tag to drop into its head. Use it when the same content is reachable from more than one URL, such as tracking parameters or www and non-www versions, so search engines index the one you choose. The tool escapes ampersands and other reserved characters for you.

How this is calculated

The output follows the rel="canonical" link element defined by the WHATWG HTML standard and used by Google for canonicalization. The URL is trimmed, checked for an http or https scheme, and its reserved HTML characters (&, <, >, ") are escaped before it is placed in the href attribute.

How to use

  1. Enter the full URL of the page you want to set as canonical.
  2. Make sure it starts with http:// or https://.
  3. Copy the generated link tag into the <head> of the page.

Examples

  • Basic page: https://example.com/blog/post
  • URL with parameters: ?q=shoes&sort=price becomes &amp;

FAQ

Where does the canonical tag go?
Inside the <head> element of the page it refers to. It should point to the version of the URL you want search engines to index.
Why is the ampersand changed to &amp;?
An ampersand is a reserved character in HTML. Writing it as &amp; keeps the markup valid while the browser still reads the URL correctly.
Should the canonical URL be absolute?
Yes. Google recommends a full absolute URL with the scheme and domain, which is why this tool requires http:// or https://.

Embed this calculator

Add this free calculator to your own site. Copy the code and paste it where you want it to appear.