# Hreflang tag generator

> Enter the URL for each language and region version of a page. The generator writes the full set of tags, with return links and a fallback, in the format you choose.

- Page: https://liftup.tech/tools/hreflang-generator/
- Type: Free tool
- Updated: 2026-11-20

## In short

Use the hreflang generator to turn a list of language and region URLs into correct tags. Add each version of a page with its code, such as en-gb or de-de, choose an x-default fallback and pick an output: HTML link tags, XML sitemap entries or HTTP headers. It writes the complete set, so every version points to every other one.

## What the generator does

Hreflang tells search engines which version of a page suits which language and region. The rules are strict, and most errors come from a missing return link. The generator builds the whole set from one list, so each page references itself and every alternate.

It checks codes as you type. A language comes first, as a two-letter ISO 639-1 code. A region is optional and follows as an ISO 3166-1 alpha-2 code, so the United Kingdom is gb, not uk.

## Inputs

| Field | Example | Note |
|---|---|---|
| Page group name | Pricing page | Only used to label the output |
| URL | example.com/uk/pricing/ | Use the full absolute URL, including the scheme |
| Language and region code | en-gb | Lowercase language, region optional |
| x-default URL | example.com/pricing/ | The page for visitors who match none of your codes |
| Output format | HTML, sitemap or HTTP header | Pick one method per site, not several |

## Worked example: four versions

A company runs English pages for the United States, United Kingdom and Australia, plus a German page for Germany. For one pricing page the list is below.

| URL path | Code |
|---|---|
| /us/pricing/ | en-us |
| /uk/pricing/ | en-gb |
| /au/pricing/ | en-au |
| /de/preise/ | de-de |
| /pricing/ | x-default |

The generator outputs five tags and places them on all four regional pages and on the default page. Each page therefore carries all five. The German page links back to the three English pages, and each English page links to it. That mutual linking is what search engines check.

## Which output to choose

- HTML link tags in the head: simplest for small sites and easy to inspect.
- XML sitemap entries: better for large sites, because the pages stay lighter and one file holds the whole map.
- HTTP headers: the only option for files that have no head, such as PDFs.

Use one method. Mixing methods invites conflicts, and a conflict can lead engines to ignore the signal.

## Common mistakes the generator flags

- A page that does not reference itself
- A missing return link from an alternate
- Invalid codes, such as en-uk or an underscore instead of a hyphen
- An alternate URL that redirects, returns an error or is blocked by robots.txt
- A canonical tag pointing to a different language version

Hreflang is a hint rather than a command, and it works when each version is genuinely localized. For planning the structure, see [international SEO](https://liftup.tech/services/international-seo/) and the [international SEO checklist](https://liftup.tech/checklists/international-seo-checklist/). More checks to build into your release process are in [SEO tools for web developers](https://liftup.tech/guides/seo-for-developers/).

## Questions, answered

### Do I need x-default?

It is recommended. It names the page for visitors whose language or region matches none of your codes, often a language selector or your main English page.

### Can I use hreflang for language only?

Yes. Use a language code such as de for German speakers anywhere. Add a region only when content differs by country, for example currency or legal terms.

### Does hreflang improve rankings?

It does not boost rankings by itself. It helps show the right version to the right user and reduces duplicate-content confusion between similar versions.

### How do I check that it worked?

Look at the pages in Google Search Console and test a few alternates by hand, confirming each returns a normal status and links back. Allow time for recrawling before you judge the effect.

### How do I generate hreflang tags?

List every language and region version of one page with its full URL and code, add an x-default URL, choose HTML, sitemap or HTTP header output and copy the result onto every version. Each page must carry the full set, including a tag that points to itself.

### Which language and region codes should I use?

Use a lowercase two-letter language code, then an optional uppercase region code, such as en-gb or de-at. The United Kingdom is gb, not uk. Use a language-only code such as de when you do not target a specific country.

## Related

- [International SEO: one site, several countries, no cannibalization](https://liftup.tech/services/international-seo/)
- [International SEO checklist](https://liftup.tech/checklists/international-seo-checklist/)
- [Schema markup generator](https://liftup.tech/tools/schema-markup-generator/)

---

Get a fixed quote: https://liftup.tech/contact/ · email rohit@liftup.tech · WhatsApp +91 77689 10234 (https://wa.me/917768910234) · reply within one working day.
Source page: https://liftup.tech/tools/hreflang-generator/ (Liftup Technologies)
