Canonical Tag Generator
Enter the preferred URL for a page, optionally add its language versions, and get correct, escaped <link> tags to paste into the page head. No website is fetched or checked.
1. URLs
Localhreflang alternates (optional)
Add a row for each language or regional version, e.g. en-gb → its URL.
2. HTML for the <head>
EscapedPreview
The preview appears once the URLs are valid.
Place the generated tags inside the <head> of the matching page. Search engines treat canonical tags as a hint and may choose a different URL.
About Canonical Tag Generator
Canonical Tag Generator creates a correctly escaped <link rel="canonical"> tag for the preferred URL of a page, and optionally the hreflang alternate tags for its language versions and an x-default link. A preview shows exactly which URLs the tags point to.
When the same content is reachable at several URLs — with tracking parameters, trailing slashes or printer-friendly versions — a canonical tag tells search engines which one you prefer. Generating it avoids typos and unescaped characters that would make the tag unreliable.
Step by step
- Enter the full canonical URL of the page.
- Optionally add a page title to label the preview.
- Add hreflang alternates for other language or regional versions if you have them.
- Tick x-default and enter its URL if you use a fallback page.
- Review the code and the preview.
- Copy the code or download it, and paste it into the page's <head>.
What it offers
- Validates absolute http:// and https:// URLs
- Optional hreflang alternates with language-code checks
- Optional x-default alternate
- HTML-escaped attribute values
- Visual preview of the canonical and alternate URLs
- Copy code or download as .html
Tips for best results
- Use the exact, final URL you want indexed, including https:// and the preferred host.
- Add the tag to the <head> only, and use one canonical tag per page.
- Point the canonical at a page that returns 200 and is not blocked by robots.txt.
- With hreflang, list every language version on every version, including itself.
- Keep canonical tags, internal links and sitemaps consistent with each other.
Why people use it
Clear preference
Signals which URL you want treated as the main version.
Correct markup
Escaped, well-formed tags every time.
Multilingual ready
Generate hreflang alternates in the same step.
Private
Generated in your browser — no page is fetched.
Common questions
This runs entirely in your browser
No file or text you enter here is uploaded. Encoding and decoding happen on your device using native browser APIs — close the tab and nothing remains on a server.