Talk to a person. We reply within one working day.

SEO and AI search
Web
AI
Resources
WorkAboutStart a project

Hreflang generator

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.

By the Liftup team in Pune

We Make In India, a project by Liftup Technologies
Searchyoursite.com
Our work: We Make In India

350+businesses served

8countries

7+years

  • Ajyal Al Mustakbal Education
  • APHERO
  • Bimble
  • D'Decor
  • Edunova
  • Emoticons India
  • Gatha
  • Improp
  • Interakt
  • Jai Ganesh Industries
  • Medicine Free Life
  • Premium Learnings
  • Serene Eco Village
  • Tata Tele Business Services
  • WTS Management

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.

Rather have it done for you? See our technical SEO service, from $1,500.

On this page 5 sections
  1. What the generator does
  2. Inputs
  3. Worked example: four versions
  4. Which output to choose
  5. Common mistakes the generator flags

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

FieldExampleNote
Page group namePricing pageOnly used to label the output
URLexample.com/uk/pricing/Use the full absolute URL, including the scheme
Language and region codeen-gbLowercase language, region optional
x-default URLexample.com/pricing/The page for visitors who match none of your codes
Output formatHTML, sitemap or HTTP headerPick 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 pathCode
/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 and the international SEO checklist. More checks to build into your release process are in SEO tools for web developers.

Updated 20 November 2026

Questions, answered

Something else on your mind? Ask us directly or WhatsApp us. We reply within one working day.

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.

Running a multi-region site?

We review the full setup and give you a fixed quote after a short call.

Get a free quote