Use the Canonical Tag Generator by entering a complete preferred HTTP or HTTPS URL, generating the rel=canonical link element, and copying it into the HTML head. This produces an HTML annotation that identifies the URL you want search engines to prefer; it does not force a selection or redirect visitors.
Start by identifying the actual preferred version. If duplicate addresses serve equivalent content, both may reference the same canonical target, but that target should be a public page that returns HTTP 200. A canonical is a strong signal, not an instruction that guarantees Google or another search system will select it.

What the generator changes
The generator parses the target with the browser’s URL implementation, removes the fragment, serializes the remaining URL, and then HTML-escapes the href attribute. The WHATWG URL Standard defines browser URL serialization, which accounts for rules such as lowercase hosts, removal of default ports, and ASCII-compatible forms for internationalized domains.
| URL component | Generator behavior | What to check |
|---|---|---|
| Scheme | Accepts HTTP and HTTPS and rejects other schemes | Confirm the target begins with the intended protocol |
| Host | Converts host case to lowercase | Check that the normalized host names the correct site |
| Default port | Removes a default port from the serialized URL | Make sure the remaining host and port represent the intended page |
| Path | Preserves path case while serializing non-ASCII characters | Check capitalization because paths can be case-sensitive |
| Query string | Preserves parameters and their order | Remove only parameters that should not identify the canonical target |
| Fragment | Removes the fragment from the target | Use the underlying resource URL rather than a location within it |
| Credentials | Rejects usernames and passwords embedded in the URL | Never expose credentials in a canonical tag |
These transformations make the result a browser-standard URL, but they do not decide which page deserves preference. A root address also receives a trailing slash during serialization, while an intentional query string remains part of the requested target.
Generate and install the canonical tag
- Choose the preferred target. Select the URL for the page you want search engines to prefer. Avoid selecting an arbitrary address merely because its path looks cleaner; the target should represent the page you actually want to consolidate to.
- Enter the complete absolute URL. Include the scheme, host, path, and any intentional query string. The generator accepts only HTTP and HTTPS URLs. Relative paths such as /products/widget are rejected, as are FTP, javascript, data, and other unsupported schemes. Credentials embedded in the URL are also rejected.
- Generate the tag and review the normalized address. The input remains in your browser. Compare the displayed result with the URL you entered and confirm that the changes are appropriate. Intentional query parameters remain, while a fragment is removed.
- Compare the result with the real page. Open the normalized target and confirm that it returns HTTP 200 and serves the equivalent primary content you want consolidated. If it redirects elsewhere, resolve that routing issue before publishing the canonical.
- Copy the exact generated element into the HTML head. Place it inside head, not body. Copy the generated markup as produced so that query-string ampersands remain correctly escaped for HTML.
- Inspect the delivered page. View its source or inspect the document head on the real URL. Confirm that exactly one intended canonical element appears and that its href points to the selected HTTP 200 page.
For example, an input such as https://example.com/catalog?category=tools&sort=price produces an element in the form <link rel="canonical" href="https://example.com/catalog?category=tools&sort=price">. The HTML source uses & so the attribute is valid markup, while the parsed href contains the ordinary ampersand that was requested.
Match the target to the preferred page
The generated href should identify the resource you genuinely want search systems to treat as canonical. Reviewing the content and purpose of that target is more important than merely producing syntactically valid markup. Google Search Central’s canonicalization guidance explains that canonicalization is one signal considered alongside other page and site-level evidence.
| Page situation | Recommended canonical treatment |
|---|---|
| The preferred content page | Use a self-referential canonical pointing to that page, which is a commonly recommended approach |
| An accessible duplicate | Point to the same preferred target as the original page |
| A duplicate that should no longer be served | Use a permanent redirect rather than relying on a canonical to perform the redirect |
| An intentional parameter-based URL | Preserve the selected query string when it identifies equivalent preferred content |
| A page requiring authentication | Review whether it should be indexed; canonicalization does not make private content public |
A canonical tag does not redirect users, immediately remove a URL from search results, or replace a migration redirect. It also cannot overcome a target that contains different primary content. When a URL should remain accessible, pointing it to the same preferred page keeps the duplicate signal consistent.
Keep one canonical signal in the head
Place the generated element in the HTML head and make sure the page does not also contain a different canonical link. A single clear element is easier to verify than several competing tags. If the site uses an HTTP canonical header, a sitemap, or template-level canonical, make those signals identify the same preferred URL.
Internal links should also lead toward the preferred address. Conflicting directions—such as an HTML canonical for one URL, an HTTP header for another, and a sitemap entry for a third—make the site’s preference less clear. The generator cannot edit a CMS template, resolve those conflicts, or verify how a framework renders the final document, so those checks remain part of publishing.
Make routing decisions before generating
The tool deliberately avoids guessing decisions that depend on your site’s routing and content. In particular, it does not:
- Remove tracking parameters.
- Sort query keys.
- Force HTTPS.
- Add or remove www.
- Choose a trailing-slash policy.
- Resolve redirects.
- Inspect whether two pages contain similar content.
Make those choices before entering the target. For example, a tracking parameter that every page receives may not belong in a canonical URL, while a parameter that selects genuinely different content may need to remain. Removing parameters automatically or changing protocols without understanding the routing could create a valid-looking tag that points to the wrong resource.
Verify server-rendered and client-rendered pages
The generator returns markup only. After copying that markup into a template or application, verify the actual delivered document rather than assuming the framework inserted it correctly. For client-rendered applications, make the canonical clear in the source output and avoid scripts that mutate it inconsistently after the page loads.
- Inspect the document head on the real, public URL.
- Confirm that only one intended canonical element is present.
- Check that its href resolves to an HTTP 200 page with equivalent primary content.
- Test representative routes and templates instead of assuming one successful page covers every page type.
- Ensure duplicate versions point to the same target and important internal links use that preferred address.
The workflow is complete when the generated href, the live HTTP 200 target, the HTML head, and the site’s other canonical signals all identify the same preferred URL. If they differ, correct the URL policy, routing, template, or conflicting signal before publishing the tag.
For a deeper look, see Do You Need a Meta Robots Tag Generator? How to Decide.
For a deeper look, see How Do I Get Started Generating a Canonical Tag?.