AnyTool
Your files never leave your device. All processing happens locally in your browser.

How do I generate a canonical tag for a web page?

Open AnyTool’s Canonical Tag Generator, paste the preferred (canonical) URL of the page, and it instantly builds the <link rel="canonical" href="…" /> tag for your <head> plus an HTTP Link-header version for PDFs and other non-HTML files. Add any duplicate URLs and it generates the canonical tag each one should carry, all pointing at the preferred URL, while a validation panel flags relative URLs, http vs https, tracking parameters and trailing-slash issues. Everything runs in your browser — nothing is uploaded or crawled.

  • Builds an absolute, self-referencing rel="canonical" link tag for the page <head>
  • Also outputs the HTTP "Link: <…>; rel="canonical"" header for PDFs / non-HTML
  • Generates the matching canonical tag for each duplicate / variant URL
  • Live validation: relative URL, http not https, UTM params, trailing-slash and case mismatches
  • 100% client-side — your URLs never leave the browser; a canonical is a hint, not a guarantee

What is

Canonical Tag (rel="canonical")

A canonical tag is a <link rel="canonical"> element in a page’s <head> (or an equivalent HTTP Link header) that tells search engines which URL is the preferred, master version of content available at several URLs. It consolidates duplicate-content signals onto one URL, but it is a hint, not a directive: Google may still choose a different canonical, and it neither removes a page from the index (use noindex) nor redirects users (use a 301).

SEO & Web

Related terms

Duplicate contentSelf-referencing canonical301 redirectnoindexHTTP Link header

Frequently Asked Questions

No. A canonical is a hint, not a directive. Google weighs it with other signals and can still pick a different canonical, so verify the chosen URL in Search Console.

rel="canonical" is a suggestion to search engines, not a command. Google combines it with signals like internal links, sitemaps, redirects and HTTPS, and may select a different canonical than the one you declared. It does not remove a duplicate from the index by itself (that is what noindex does) and it is not a redirect (use a 301 to actually move users). Place one absolute, self-referencing canonical per page, point it at a URL that returns 200, and confirm the canonical Google actually chose using Search Console’s URL Inspection tool.

Always absolute — the full URL with https:// and the host. Relative canonicals are fragile and can resolve to the wrong page.

Google recommends absolute URLs in rel="canonical" — for example https://example.com/page rather than /page. A relative path is resolved against the current page’s URL and can point at an unintended location, especially on parameterized or paginated URLs. This generator validates that your canonical is absolute and uses https, and warns when it is not.

Use a canonical for duplicate pages you want to keep live, noindex to remove a page from search entirely, and a 301 when you have actually moved a page.

Use rel="canonical" when the same or near-identical content sits on several URLs you want all kept accessible (URL parameters, http/https, trailing-slash variants, syndicated copies) and you want ranking signals consolidated onto one. Use noindex when a page should stay reachable for users but be kept out of search results, and never point a canonical at a noindex page. Use a 301 redirect when a page has permanently moved and both users and crawlers should be sent to the new URL.

You can’t add a <link> tag to a PDF, so send an HTTP "Link: <url>; rel="canonical"" response header. This tool generates that header for you.

Because non-HTML files such as PDFs have no <head>, the canonical is declared through an HTTP response header instead: Link: <https://example.com/file.pdf>; rel="canonical" (per RFC 5988). The Canonical Tag Generator outputs this header version alongside the HTML tag so you can configure it on your server or CDN for downloadable files.

Detailed Explanation

How It Works

What the Canonical Tag Generator Produces

The Canonical Tag Generator turns a single preferred URL into a correct, absolute, self-referencing <link rel="canonical" href="…" /> element for a page’s <head>, plus the equivalent HTTP response header (Link: <url>; rel="canonical") for non-HTML files such as PDFs. Given a list of duplicate or variant URLs, it generates the canonical tag each one should carry, all pointing back at the preferred URL so search engines consolidate duplicate-content signals onto a single page.

  • Outputs both the HTML <link rel="canonical"> tag and the HTTP Link header (RFC 5988)
  • Uses absolute, https, self-referencing URLs by default — Google’s recommended form
  • Generates a matching canonical tag for every duplicate / variant URL supplied
  • Cross-domain canonicals are supported for syndicated content
  • All generation is pure client-side JavaScript — no server call, no CDN, no upload, no crawling
Methodology

How It Normalizes and Validates URLs

Each URL is parsed with the browser’s native URL API. The canonical href is optionally upgraded from http:// to https://, has tracking/UTM parameters and any fragment stripped, and is checked for being absolute. A lint pass then reports the common real-world canonical mistakes — relative URLs, http instead of https, UTM and other tracking parameters, trailing-slash and uppercase-in-path inconsistencies, URL fragments, a variant identical to the canonical, invalid duplicate lines, and cross-domain references — each with a concrete fix.

  • Parsing uses the standards-compliant URL constructor, not regex guessing
  • Optional enforce-https, strip-query and self-referencing toggles
  • Detects relative URLs, http vs https, UTM/tracking params, trailing-slash and case issues
  • Flags URL fragments (unsupported in canonicals) and variants equal to the canonical
  • Findings are ordered errors → warnings → notes → confirmations
Limitations

A Canonical Is a Hint, Not a Guarantee

rel="canonical" is a suggestion to search engines, not a directive: Google weighs it with other signals (internal links, sitemaps, redirects, HTTPS) and may still select a different canonical. A canonical does not remove a duplicate from the index by itself — that requires noindex — and it is not a redirect, so users still reach every URL; a 301 is needed to actually move a page. The recommended practice is one absolute, self-referencing canonical per page, pointed at a URL that returns 200 (never a redirected, 404 or noindex page), with the chosen canonical verified in Search Console’s URL Inspection.

  • Canonical is a hint — Google can choose a different canonical URL
  • It does not deindex a duplicate (use noindex) and is not a redirect (use 301)
  • Point the canonical at a 200 URL, not a redirect, 404 or noindex page
  • Use exactly one canonical per page, in <head> or via the HTTP header
  • Confirm the canonical Google selected with Search Console URL Inspection
Canonical tag generation: in-browser (AnyTool) vs typical online generators
CapabilityAnyToolTypical online generators
ProcessingRuns entirely in your browserOften server-side
Your URLsNever uploaded or crawled, works offlineSometimes sent to a server
HTTP Link header (for PDFs)Generated alongside the tagRarely offered
Per-duplicate tagsA tag for each variant URLUsually one tag only
ValidationLint for relative/http/UTM/trailing-slash/case/cross-domainOften none
Honesty about limitsClear hint-not-a-guarantee noticeSometimes implies a guarantee
Cost / signupFree, no signupOften gated or ad-heavy

AnyTool builds the canonical tag and HTTP header locally and uploads nothing. A canonical tag is a hint to search engines, not a guarantee — Google can still choose a different canonical; it does not deindex duplicates (use noindex) and is not a redirect (use a 301). Comparison as of June 2026.