Hreflang Tag Generator & Validator
Generate and validate hreflang link tags and XML sitemap entries. CSV bulk import, x-default ready, return-tag checks built in.
Why use this tool
01Build hreflang annotations from locale and URL pairs, import dozens at once from CSV, and validate an existing block for return-tag errors, duplicate locales, and malformed ISO codes. Outputs both inline HTML link tags and XML sitemap entries. Runs in your browser, no signup, no URL cap.
Turn a list of locale plus URL pairs into a complete hreflang block — for your page head or sitemap — and validate existing annotations for the bugs that make Google silently drop them.
Use it when you ship a new translation, add a regional variant such as en-US, en-GB, or en-AU, audit existing hreflang on a multi-language site, or import dozens of locales at once from a CSV.
The validator catches the issue most generators ignore: missing return tags (when page A links to B but B does not link back), duplicate locales pointing to different URLs, malformed ISO codes, and missing x-default. Reciprocity is the #1 reason Google ignores a hreflang declaration — get it right before publishing.
Unlike many online tools, there's no URL cap, no signup, and no upload — locales and URLs you enter stay in your browser. Pair with our SERP preview and canonical tag checker for full international SEO preflight.
How to use
02Quick checks before you copy
03Confirm the input is the format you intended.
Scan the result before using it in a document, URL, config, or message.
Copy only the output you need.
Use Cases
When you add a Spanish or Japanese version of a page, you need hreflang on both the original and the new page so Google treats them as alternates. This tool generates the matching block for both sides at once.
If you serve different content to en-US, en-GB, and en-AU visitors (currency, shipping, terminology), each region needs its own hreflang tag plus a shared x-default fallback.
Paste your current locale plus URL pairs to confirm every alternate references every other (the bidirectional rule), and that your x-default points to the correct page.
On sites with thousands of localized pages, embedding hreflang in every HTML head bloats every page. Generate the XML sitemap variant instead and centralize your hreflang declarations in one file.
Tips & Tricks
- 01Hreflang must be bidirectional
If page A points to page B as its Spanish alternate, page B must point back to page A as its English alternate. Missing return links are the most common hreflang bug — Google silently ignores half-pair declarations.
- 02Always include x-default
x-default tells Google which page to show users whose language doesn't match any of your alternates. Without it, Google may pick an unpredictable variant for global searchers.
- 03Use ISO codes, not country or language names
hreflang values are ISO 639-1 language codes (en, fr, ja) optionally followed by ISO 3166-1 alpha-2 region codes (en-US, en-GB). Do not use country names like "British" — Google will ignore the tag.
- 04HTML link tag vs XML sitemap — pick one delivery
You don't need both. Link tags in the head are convenient for small sites; XML sitemap entries scale better for sites with hundreds of locales. Mixing them works but is redundant.
FAQ
04What is hreflang and when do I need it?
Hreflang is an HTML attribute that tells Google which version of a page to show users in different languages or regions. You need it when the same content exists in multiple translations or regional variants (e.g., en-US vs en-GB). Without it, Google may show the wrong language or treat your translations as duplicate content.
Do hreflang tags need to be bidirectional?
Yes. Every page in a hreflang group must reference every other page, including itself. If the English page references the Spanish version, the Spanish version must reference the English back. Google ignores hreflang tags that aren't reciprocal.
What is the x-default hreflang and is it required?
x-default specifies the fallback page shown when no locale-specific version matches a user's settings. It's strongly recommended (especially for global homepage layouts) but not strictly required. We recommend always including it.
Why is Google ignoring my hreflang tags?
The #1 reason is missing return tags — page A points to page B as an alternate, but B does not point back to A. Google requires every page in a group to reference every other page (including itself). Other common causes: malformed locale codes (use ISO 639-1 plus ISO 3166-1, not country names), pointing to redirecting URLs, or mixing canonical and hreflang in conflicting ways. Use the Validate tab to surface these before publishing.
Do I need self-referencing hreflang tags?
Yes — strongly recommended. Each page should list itself as one of the alternates in its own hreflang block (for example, the English page declares en-US as one of its alternates pointing to its own URL). Without a self-reference, Google may treat the group as ambiguous and pick an unpredictable variant for search results.
Can I bulk-import locales from a CSV?
Yes. Drop a CSV file with two columns — locale, URL — onto the dropzone in Generate mode. A header row (locale,url) is auto-detected and skipped. Empty rows are filtered out. The status message reports how many locales loaded.
Should I put hreflang in HTML head or in sitemap.xml?
Both work — Google treats them equivalently. Link tags in the head are easier for small sites. XML sitemap declarations scale better for large sites with hundreds of alternates per page (and avoid bloating every HTML response). Pick one delivery channel per page to keep things consistent.
Does hreflang work for region-only variants like en-US vs en-CA?
Yes, this is the primary use case for regional codes. The format is language-region where region uses ISO 3166-1 alpha-2 (en-US, en-GB, en-AU, en-CA). Google will show the right variant based on user location and browser language.
Can I use hreflang across subdomains or different domains?
Yes. hreflang URLs can point to subdomains (es.example.com), subdirectories (example.com/es/), or entirely different domains (example.es). All three are equally valid as long as you reference the full canonical URL.
Do I need hreflang if I only publish in one language?
No. Hreflang is only meaningful for content that exists in multiple languages or regional variants. Single-language sites don't need it.
Is the generator safe to use with proprietary or staging URLs?
Yes. Everything runs in your browser. No URLs, locales, or generated tags are sent to any server — there's no upload, no logging, no tracking.
Related tools
03Canonical Tag Checker→
Compare a page URL and canonical URL to spot self, cross-domain, and mismatched canonicals.
Sitemap URL List Generator→
Clean, trim, and deduplicate page URLs before building a sitemap file.
SEO Preflight Workspace→
Run page launch checks for title, description, canonical, robots, sitemap, and hreflang in one workspace.