Map Extract
Free tool

Hreflang tag generator and checker

List each language or country version of a page with its full address. The tool checks every code against the ISO lists, corrects the common slips, and writes the tags as HTML, as XML sitemap entries or as an HTTP Link header.

Runs in your browser. Nothing you enter is uploaded.

Building the tags

  1. Enter one row per version

    Type the code on the left, such as en-GB or cy-GB, and the full URL with https:// on the right. A new empty row appears as you fill the last one.

  2. Set the x-default URL

    This is the page shown to people whose language matches none of your versions, often the main English page or a language picker.

  3. Read the warnings

    Each says which row is affected and whether it was corrected automatically or left out of the output.

  4. Pick the format

    HTML link tags go in the head of every version. XML sitemap gives one <url> entry per version with all the alternates. HTTP header is for files that have no head, such as PDFs.

Example: four rows, three mistakes

A tile retailer (fictional) lists its UK, Irish and French pages. It typed one code with an underscore, used UK instead of GB, gave the French page as a relative path, and forgot the x-default. The generator fixes the first two codes, notices that the corrected UK row duplicates the first one, and drops the French row until it has a full address.

Input
en_GB  https://www.tilestudio.example/
en-IE  https://www.tilestudio.example/ie/
en-UK  https://www.tilestudio.example/uk/
fr     /fr/
x-default: (empty)
Result
Row 1: Use a hyphen, not an underscore: en-GB. Corrected in the output.
Row 3: The UK region code is GB, not UK: use en-GB. Corrected in the output.
Row 3: en-GB is listed twice; each language and region needs one URL.
Row 4: "/fr/" is not an absolute URL.
No x-default: add one for visitors whose language matches none of your versions.

<link rel="alternate" hreflang="en-GB" href="https://www.tilestudio.example/" />
<link rel="alternate" hreflang="en-IE" href="https://www.tilestudio.example/ie/" />

Codes that trip people up

You might typeCorrect formReason
en-UKen-GBThe ISO 3166-1 country code for the United Kingdom is GB
en_GBen-GBHreflang uses a hyphen between language and region
GBen-GBThe value must start with a language; a country alone is not valid
cycy or cy-GBWelsh on its own is fine; add GB only if you also target Welsh speakers elsewhere
zh-Hant-HKzh-Hant-HKA four-letter script subtag between language and region is allowed

The rule people forget

Hreflang only works when every version carries the full set of tags, including one pointing at itself. If the Irish page links to the UK page but the UK page does not link back, search engines may ignore the pair. Paste the same block into the head of each version, or let the sitemap format list every alternate under each URL.

The tool also notes when you have regional English pages but no plain en fallback. That is optional, but it catches English speakers in countries you have not listed.

Questions people ask

Is it en-GB or en-UK for British English?

en-GB. Hreflang region codes come from ISO 3166-1, where the United Kingdom is GB. UK is reserved and not a valid region code, so en-UK is ignored by search engines. The generator rewrites en-UK to en-GB and tells you it has done so.

Do I need an x-default tag?

It is not required, but it is good practice. x-default names the page for visitors whose browser language matches none of the versions you list, usually your main page or a language chooser. Without it, search engines pick a version themselves, which may not be the one you want.

Should hreflang go in the HTML or in the sitemap?

Either works; use one method consistently. HTML link tags are simplest for a few pages. A sitemap is easier to maintain when you have many pages, because the tags live in one file. The HTTP header method is meant for PDFs and other files without an HTML head.

Does the generator check that my URLs work?

No. It checks that each URL is a full address starting with http or https and that no code or URL is repeated, but it does not visit the pages. Open each one yourself to confirm it loads, is not redirected and carries the same set of tags.

Where your data goes

Codes and URLs are validated and written into tags by script running in your tab. The addresses are not visited, looked up or stored.

Checked against the tool on

Top