A canonical tag generator example shows a single <link rel="canonical" href="https://example.com/page"> element built from one absolute URL, with the fragment dropped, the host lowercased, the default port removed, and query-string ampersands escaped to &. The marker sits in the HTML head of every duplicate or near-duplicate page and points search engines toward the URL you want indexed, which makes the result a one-line, browser-emitted fragment you can paste into a template. Because the tool runs in your browser, the URL you type is parsed by the WHATWG URL implementation, not by a server, and the input is never uploaded. The element is a strong preference, not a command: Google may still choose differently based on redirects, sitemaps, internal links, and the actual content it can reach on the canonical target. The generator's job is narrower than a CMS plugin's job; it produces standards-aligned markup from one explicit target so that whatever ships to the visitor carries one consistent canonical address.

What Changes Before the Tag Is Emitted
Before any HTML is emitted, the browser's URL parser normalizes the input according to the WHATWG URL Standard. The tool then HTML-escapes the result so it is safe inside an attribute value. The Canonical Tag Generator surfaces both the normalized URL and the final markup so you can compare them against the live 200 response before pasting into a template.
| Normalization step | Effect on the input | Example (input to result) |
|---|---|---|
| Fragment removal | Discards anything after # | https://example.com/page#details to https://example.com/page |
| Host case | Lowercases letters in the host | WWW.Example.COM to www.example.com |
| Default ports | Omits :80 on HTTP and :443 on HTTPS | https://example.com:443/p to https://example.com/p |
| Internationalized domain | Converts Unicode host to IDNA ASCII | https://xn--mnchen-3ya.de/x stays https://xn--mnchen-3ya.de/x |
| Path case | Preserved exactly as written | /Products/Widget stays /Products/Widget |
| Query string | Preserved verbatim, including key order | ?id=42&ref=email stays ?id=42&ref=email |
| HTML attribute escaping | Rewrites & to & inside the href | URL & becomes attribute & |
For the behind-the-scenes rules, the normalization cheat sheet collects these in one printable reference. Each row addresses a different question: whether the duplicate carried a tracking anchor, whether the marketing team typed the host in mixed case, whether the link was copied from an editor that included the explicit scheme port, whether the brand uses a non-ASCII domain, or whether the path matters for routing on a case-sensitive web server. Path case is the one piece the parser does not touch, because silently changing it could send the canonical to a 404.
Worked Example: a Product Page With Query Strings
A practical canonical tag generator example starts with a real URL pasted in by a content editor. Suppose the preferred product page is:
Input: https://Example.com:443/products/Widget?id=42&utm=email
After the browser parser runs, the normalized URL becomes:
Normalized: https://example.com/products/Widget?id=42&utm=email
The host case was folded to lowercase, the explicit HTTPS port 443 was removed, and both the capital P in products and the capital W in Widget were preserved because path case can be significant on case-sensitive web servers. The two query keys id and utm were kept in the same order because they may be part of a deliberate canonical address that the marketing team has chosen to share externally.
The HTML the generator then emits is:
Output: <link rel="canonical" href="https://example.com/products/Widget?id=42&utm=email" />
Notice that the only visible character change between the normalized URL and the attribute value is the first ampersand after id=42, which appears as & inside the attribute. That difference is required HTML; browsers decode the entity back to & when they resolve the href, so the canonical URL the search engine sees is the address you intended.
Worked Example: an Internationalized Domain With a Fragment
A second canonical tag generator example uses a different normalization path. The marketing team hands you a brand URL written for humans:
Input: https://MÜNCHEN.de/sightseeing/Top-Spots#brandenburg-tor
After normalization the URL is rebuilt for the network layer. The Unicode host münchen.de becomes its IDNA ASCII form xn--mnchen-3ya.de, the fragment brandenburg-tor is discarded because Google documentation does not support fragment URLs as canonical targets, and the case-mixed path Top-Spots is left alone because path case is significant:
Normalized: https://xn--mnchen-3ya.de/sightseeing/Top-Spots
The HTML the generator emits is:
Output: <link rel="canonical" href="https://xn--mnchen-3ya.de/sightseeing/Top-Spots" />
This example is useful because it surfaces three behaviors in one URL: host case folding, IDNA conversion, and fragment removal. If your canonical target is a Unicode brand domain, the ASCII conversion is what search engines expect to see in the href; if your server only serves a 200 response on the Unicode form, the canonical will point at the wrong address and you need to fix routing first.
How to Use the Generator Step by Step
The generator's three documented steps cover input, review, and placement, and each one maps to a verification you should run yourself before publishing.
- Enter the complete preferred HTTP or HTTPS URL into the input field, including the scheme (http:// or https://), the host, the path, and any query string that the chosen canonical should carry. Do not enter a relative path or a URL that contains credentials.
- Generate the tag. The page displays the normalized URL alongside the HTML element. Compare the normalized URL with the real 200 response you expect from your server for that path and query. The two should resolve to the same primary content.
- Copy the <link rel="canonical" href="..."> element into the head of every duplicate or near-duplicate page. Each variant should resolve to the same canonical target so the signal is consistent rather than fragmented.
- Reload each affected page, view source or inspect the head, and confirm there is exactly one rel="canonical" element and that its href still resolves to a 200 response with equivalent content. Resolve any redirect loops or 404s the canonical may have picked up before they reach production.
Inputs the Generator Rejects (and Why)
The generator refuses some inputs by design so the markup it produces is never a guess:
- Relative paths such as /products/widget are rejected because their meaning depends on the document they are embedded in. A canonical must identify a public content location, and the parser cannot infer the scheme or host from context.
- Non-HTTP schemes such as ftp://, javascript:, data:, and mailto: are not valid canonical targets and are surfaced as rejections.
- Credentials embedded in the URL, such as https://user:[email protected]/page, are rejected. Canonical markup is public, so embedding a password in it would expose the password to every visitor.
- Authentication-gated pages are a separate question. A canonical does not turn a private page into a public one or solve access control. If the page should not be indexed at all, decide whether the canonical should exist in the first place.
Where to Place the Tag and How to Verify It
The element belongs inside the HTML head of every page you want to consolidate. One element per page is the recommendation; multiple conflicting canonical elements weaken the signal. For WordPress sites with dynamic templates, the practical placement is documented in this WordPress canonical tag guide, but the same rules apply to any CMS or static site: the tag should be present in the source HTML the visitor receives, not injected late by client-side script that may render after the document is captured.
To verify, open the live URL, view source, and search for rel="canonical". Confirm the href returns a 200 with equivalent primary content, and that the same canonical is set across representative routes (the home page, a paginated listing, a parameterized product URL) and not only on the page you happened to test first. If your stack emits canonicals in three places (HTML head, an HTTP header, a sitemap entry), make sure all three agree; conflicting signals force the search engine to guess which address you meant.
What a Canonical Tag Cannot Do
A canonical is a strong signal, not a command. Per Google's canonical documentation, search engines combine the canonical element with redirects, sitemap entries, internal links, and the actual content on the candidate URLs before deciding which one to index. The generator cannot resolve redirect chains, change site routing, or strip tracking parameters; those decisions are upstream of the markup and need site-level work.
Two common misconceptions sit behind that scope:
- A canonical tag is not a redirect. It does not move users, and it does not remove a duplicate from the index on its own. Use a permanent 301 redirect when a URL should no longer be served.
- A canonical tag is not a substitute for fixing duplicate content. If two pages have meaningfully different body content, pointing one at the other only papers over the difference; consolidate the pages first, then add the canonical.
That is the practical scope of the generator's output: one consistent, escapable, normalized annotation that you place inside the head and that you verify against a 200 response every time the URL changes.