Skip to main content

Hreflang Tag Generator: Language and Region Tags in One Click

A hreflang tag generator writes the code that tells Google which version of a page to show to which visitor. If you run an English page and a Spanish page for your customers, hreflang connects the two.

Pages and languages

0 valid entries

Fallback page for visitors whose language matches none of your versions (for example, a global homepage)

Enter at least one URL with its language to generate the tags.

In short: For US local businesses the most common case is an English site with a Spanish version. Enter each URL, pick the language and region, and copy either HTML link tags or XML for your sitemap.

Both outputs follow Google's rules, including the self-referencing entry and the optional x-default.

How to use the hreflang tag generator

Add one row for each version of the page. Enter the full URL, pick the language and, if needed, the region. Add an optional x-default URL, choose HTML or XML output and copy the result. Paste the same set of tags on every version listed.

Each row needs an absolute URL, including https://. The generator warns you if one is missing or if two rows share the same code.

Use the HTML option for a few pages and the XML option when you have many. The XML goes into your sitemap file.

Hreflang tags vs sitemap hreflang

You can declare hreflang in three places: link tags in the head of each page, HTTP headers, or your XML sitemap. All three mean the same thing to Google. Choose one method and keep it consistent. Link tags suit small sites, and sitemap entries are easier to maintain on larger ones.

Never mix methods for the same URLs, because conflicting declarations are harder to debug. The generator's HTML tab gives you head tags, and its XML tab gives you a ready sitemap with the xhtml namespace included.

The rules Google expects you to follow

Every version must list all versions, including itself. If page A points to page B, page B must point back to A. Use ISO language codes with optional ISO region codes, such as en-US or es-US. A region code cannot stand alone, and every URL must be fully qualified.

Missing return links are the most common error, and Google ignores the annotations when they are not confirmed from both pages.

  • Language: two letters, such as en or es
  • Region: optional, two letters, such as US or MX
  • Add the self-referencing tag on every page
  • Use the same canonical URL in hreflang and in the canonical tag

When a US local business needs hreflang

You need hreflang when you publish the same page in more than one language or for more than one region: an English page and a Spanish page for the same service, or separate pages for the US and Canada. A single-language site with city pages does not need it.

A dentist in San Antonio with an English and a Spanish page for implants is a typical case. A plumber with one English page per city is not.

Translated pages should read as written for that audience. Machine copies with the same text barely help the visitor.

What x-default does

The x-default tag names the page Google should show when no version matches the searcher's language or region. Point it to a language picker or to your main version. It is optional, but it prevents visitors from landing on a page they cannot read.

Most small sites point x-default to the English page. Larger sites point it to a page where visitors choose their language.

Common hreflang mistakes

The most frequent errors are missing return tags, invalid language or region codes, relative URLs and tags that point to pages that redirect or return an error.

Every page in a hreflang set must link back to every other page in the set. If page A points to page B but B does not point back, Google may ignore the pair.

Use full absolute URLs, and make sure each URL in the set loads with a 200 status. The HTTP status code checker on this site can confirm that.

  • Include a self-referencing tag on every page
  • Use valid ISO codes, such as en-US and es-US
  • Never point hreflang at a redirected or blocked page

Language only or language plus region

Use a language code alone, such as es, when the page suits all speakers of that language. Add a region, such as es-US, only when the content really differs for that country.

A business with one English page and one Spanish page for the same US market only needs en and es, or en-US and es-US if you want to be explicit.

The language comes first and the region second. Writing en-UK is a common mistake: the correct code for the United Kingdom is en-GB.

A bilingual local business example

A restaurant in San Antonio with an English menu page and a Spanish menu page would add two tags to each page, one for each version, plus an x-default pointing to the main page.

Each version declares itself and the other. Visitors who search in Spanish are more likely to land on the Spanish page, and English searchers on the English one.

Keep the content equivalent. Translating a page loosely or changing the offer defeats the purpose of linking them.

Test your hreflang setup

After you publish, view the page source and confirm the tags are in the head, then request the pages in Google Search Console and watch for errors or warnings.

Open each language version in a private window and check that the links between them work.

If you manage many pages, check a few sample pages from each section. Fix the pattern once, not page by page.

Planning a Spanish version of your pages?

We build local pages that rank and read naturally. Start with an audit of what you have. Book a free 30-minute audit.

Sources: Google Search Central: Localized versions of your pages (hreflang).

Frequently asked questions

A hreflang tag is a line of code that tells Google a page has equivalent versions for other languages or regions, and which URL each one lives at. It helps Google show the right version to the right searcher.

Share this page

We audit your profile. Then we talk.

Book 30 minutes on video with the founder. We prepare your local SEO audit, go through it together, and you decide.

Free audit, reply within 24 hours. You sign nothing today.
  1. 01
    You book your call
    Pick a 30-minute slot in the founder’s calendar.
  2. 02
    We run your audit
    We review your profile, your local opportunities and your competitors before the call.
  3. 03
    We go over it on video
    We walk you through the results and talk it over openly, whether we work together or not.

ICHI, local SEO assistant

Ichiban SEO is the local SEO agency that specializes in Google Maps, founded by Nathanaël Butet. ICHI answers anything about the agency in a few seconds.

What we do

Local SEO only: getting your business into the Google Maps local pack for your city and your trade.

The guarantee

Google Business Profile optimized within 24h of getting your access, or your 2nd month is free.

Your competitor

One professional per city and per industry. Your direct competitor cannot hire us.

Pricing

Ascension: $497/month. Domination: $897/month. No setup fee.

The method

Optimized Google profile, consistent listings, customer reviews, local pages, proximity links, rank tracking.

The free audit

30 minutes on a video call with Nathanaël: we check whether your spot is open and size your potential.

Ask ICHI

Book my free audit

ICHI is an AI and can make mistakes. For advice on your case, book the free audit with the team.