Hreflang Tag Generator

Generate hreflang alternate tags for a multilingual page — give a base URL and a list of language codes, and get the link tags plus an x-default fallback to paste in the head.

SEO Tools Free No upload Instant

Loading Hreflang Tag Generator…

Your browser is preparing the tool. It runs 100% locally.

Quick Answer

Enter a page URL and a comma-separated list of language codes (like en, fr, de, es), and the tool writes one rel=alternate hreflang link tag per language, plus an x-default fallback. These tell Google which language or region version to show each user. One thing to know up front: the tool builds the alternate URLs by adding a ?lang= parameter to your base URL — if your translations live at different URLs (like /fr/ or a subdomain), edit the hrefs to match. It runs in your browser.

What the Hreflang Tag Generator Does

Hreflang tags map the language and region versions of a page to each other so search engines serve the right one — French speakers get the French URL, and so on. Type your base URL and the codes you support, and the tool outputs an alternate tag for each, finished with an x-default tag for everyone else.

Honest caveat baked in: it generates the alternate addresses as your-url?lang=fr, your-url?lang=de and so on. That suits a site that switches language by query parameter, but many sites use subdirectories, subdomains or country domains instead — in which case you should replace those hrefs with your real localized URLs before shipping.

How It Works

For each code you enter, the tool writes a link element with rel alternate, the hreflang attribute set to that code, and an href pointing at your base URL with a lang query parameter appended (joined onto the existing query string if there already is one). It then adds a final tag with hreflang x-default as the catch-all version.

Language codes follow ISO 639-1 (en, fr, de), optionally with an ISO 3166-1 region (en-US, en-GB, pt-BR). The tool takes your codes as-is, so it is on you to use valid ones — an invalid code makes Google ignore that annotation.

Generation algorithm

  1. Read the inputs. Take the base URL and the comma-separated language codes.
  2. Build each alternate. For every code, write a rel=alternate tag with that hreflang and an href of your URL plus a lang parameter.
  3. Add x-default. Append a tag with hreflang x-default pointing at the base URL as the fallback.
  4. Output live. Join them into one block to copy into the head; it refreshes as you type.

Tags it generates

for each code: link rel=alternate hreflang=CODE href=your-URL?lang=CODE plus: link rel=alternate hreflang=x-default href=your-URL

The ?lang=CODE href is an assumption about your URL structure — replace it with your real localized URLs (for example /fr/ or a country domain) if they differ. Codes are used as typed; use valid ISO 639-1 (plus optional ISO 3166-1 region).

Technical Details

Inputsbase URL, language codes (comma-separated)
Outputone alternate tag per code, plus x-default
href patternyour-URL?lang=code (assumption — edit to match)
Code formatISO 639-1 plus optional ISO 3166-1 region
Placementin the head of every language version
Where it runsIn your browser — nothing uploaded

Standards & references

  • hreflang codes — language in ISO 639-1 (en, fr, de), optionally a region in ISO 3166-1 Alpha-2 (en-US, pt-BR); an invalid code is ignored.
  • x-default — the fallback version shown when no language or region matches the user; the tool always adds it.
  • Reciprocal return tags — every language version must link back to all the others — if page A lists B but B does not list A, Google ignores the whole set.

Accuracy & Limitations

The big one: the generated hrefs use a ?lang= query parameter on your base URL. If your translations actually live at /fr/ paths, fr. subdomains or country domains, replace each href with the real URL — otherwise the tags point at addresses that do not exist.

Hreflang must be reciprocal. Every page in the set has to list every version, including itself, and each target must link back. If the return tags are missing, Google ignores the annotations entirely — so the same complete set belongs in the head of each language version, with its own self-reference.

It does not validate your codes. Use real ISO 639-1 language codes (and ISO 3166-1 regions where needed); a typo like en-UK (the correct region is GB) silently breaks that entry.

hreflang is for language and region variants of the same content, not for unrelated pages. It guides which version to show; it is not a ranking boost and it does not replace translating the page properly.

The tool generates one page's tags. You will paste a complete, matching set into each localized page, or move them to an XML sitemap or HTTP headers for large sites.

Real-World Use Cases

Multilingual sites

Map English, French and German versions of a page to each other.

Region targeting

Separate en-US from en-GB, or es-ES from es-MX, with region codes.

Adding x-default

Give search engines a clear fallback for unmatched languages.

Starting an i18n setup

Produce a template of alternate tags to adapt to your real URLs.

When to use it — and when not to

Good for

  • Pages that exist in several languages or regions
  • Generating an x-default fallback tag
  • A starting template of alternate tags
  • Sites that switch language by ?lang= parameter

Not the best choice for

  • Translations at /fr/ paths or country domains (edit the hrefs)
  • Unrelated pages (it is for same-content variants)
  • Skipping the reciprocal tags on each version
  • Validating your language codes

Different URL structure? Keep the codes but swap the hrefs for your real localized URLs. Big site? Put hreflang in an XML sitemap or HTTP headers instead of the head.

Frequently Asked Questions

What do hreflang tags do?
They map the language and region versions of a page to one another so search engines show each user the right one and do not treat the versions as duplicates.
Why do the URLs have ?lang= in them?
That is the tool's assumption — a site that switches language by query parameter. If yours uses /fr/ folders, subdomains or country domains, replace the hrefs with those real URLs.
What is x-default for?
It is the fallback version shown when a user's language or region matches none of your listed versions. The tool always adds it.
Do the tags have to be reciprocal?
Yes. Every version must link to every other version, including itself. If a return tag is missing, Google ignores the whole set — so paste the full set on each language page.
What format are the language codes?
ISO 639-1 for language (en, fr), optionally an ISO 3166-1 region (en-US, pt-BR). Use real codes; the tool does not validate them.
Is it en-UK or en-GB?
en-GB. The region is an ISO 3166-1 country code, and the United Kingdom's is GB. en-UK is a common mistake that breaks the tag.
Where do the tags go?
In the head of each language version. For big sites you can put hreflang in an XML sitemap or send it as HTTP headers instead.
Does hreflang help my rankings?
Not directly. It improves which version is shown to whom, which helps the right users land on the right page, but it is not a ranking factor on its own.
Do I still need to translate the page?
Yes. Hreflang only points at versions; it does not create or translate them. It assumes you have genuinely localized pages.
What if I only have one language?
Then you do not need hreflang at all. It is only for pages that exist in multiple language or region versions.
Does the tool check the URLs exist?
No. It formats the tags from your inputs; verify the hrefs point at real, reciprocal pages yourself.
Is anything uploaded?
No. The tags are built in your browser as you type.

References

Generates one alternate tag per code plus x-default; it is explicit that the ?lang= hrefs are an assumption to edit and that hreflang must be reciprocal or Google ignores it.

PopularHot

Meta Tag Generator

Meta Tag Generator that outputs clean, copy-ready code for better rankings.

SEOOpen Tool
Popular

Keyword Density Checker

Keyword Density Checker online — accurate, standards-compliant and free for SEO work.

SEOOpen Tool
Popular

UTM Link Builder

UTM Link Builder online — accurate, standards-compliant and free for SEO work.

SEOOpen Tool
Trending

Open Graph Generator

Open Graph Generator that outputs clean, copy-ready code for better rankings.

SEOOpen Tool
Trending

SERP Snippet Preview

SERP Snippet Preview online — accurate, standards-compliant and free for SEO work.

SEOOpen Tool
Editor's Pick

Schema Markup Generator

Schema Markup Generator online — accurate, standards-compliant and free for SEO work.

SEOOpen Tool

Ready to try the Hreflang Tag Generator?

It is free, private and runs entirely in your browser — no sign-up, no uploads, no limits.