Skip to content

Hreflang tag generator and checker

Make the hreflang tags that tell Google which language or country each version of a page is for, and check that the versions point back to each other. Paste one line per version with its language code and URL, in any order and with any separator, and get the tags in all three formats Google accepts. Every code is checked against the ISO lists, and common mistakes such as en-UK, a country code used as a language or a missing return link are flagged.

Quick answer

Hreflang tags list every language or regional version of a page, each with a code such as en, ar or ar-AE and its full URL, plus an x-default for everyone else. The same set goes on every version: as link rel="alternate" tags in the head, as an HTTP Link header, or in an XML sitemap. Each version must list itself and all the others, or Google may ignore the tags.

Runs in your browser, nothing is uploaded

Based on Google Search Central: Tell Google about localized versions of your page (last updated 21 Sep 2026) Β· Page updated 23 October 2026

Editor: Abuzar, founder of NeedMyToolsHow we check facts

Versions of the page (code and URL, one per line)

Any order and separator: en https://…, https://… ar, β€œar-AE”, example.com/ar-ae/. You can also paste existing link tags or a Link header.

Where to send visitors whose language you do not offer: a language picker or your main version.

Your hreflang tags

Paste this block into the head section of every version listed, the same block on each, including the x-default page.

Checks

No problems found.

How to use the Hreflang Tag Generator & Checker

  1. On the Generate tab, paste one line per version of the page: its hreflang code and its full URL, for example ar-AE https://example.com/ar-ae/. Tabs, commas, pipes and quotes are all fine, and you can also paste tags copied from a page.
  2. Add the x-default URL: the page for people whose language you do not offer, often a language picker or your main version.
  3. Pick a format, HTML tags, HTTP header or sitemap, read the checks, then copy or download the result and add it to every version listed.
  4. For many pages, open the Bulk tab and paste a table whose first row holds the codes and each further row one page in every language, to get one sitemap.
  5. To check existing pages, open the Check tab and paste the HTML or tags of each version after a line with its URL, or paste your sitemap. The table shows every return link that is present or missing.

How hreflang works

Google's page on localized versions, last updated on 21 September 2026 and read by us on 23 October 2026, explains that hreflang tells Google which pages are language or regional versions of the same content, so it can send each searcher to the right one. It is worth doing when the whole page is translated, when one language has small regional differences such as prices in dirhams or riyals, or when only the menus are translated. Google accepts three methods, HTML tags, HTTP headers and sitemaps, and treats them as equal; using all three brings no benefit and is harder to maintain, so pick one. Google also says it does not use hreflang or the lang attribute to detect a page's language. Each version must list itself and every other version, with fully-qualified URLs that may sit on different domains. If two pages do not point to each other, the tags are ignored, which stops another site from claiming to be a version of yours.

Language and region codes that are valid

An hreflang value is a language code in ISO 639-1, optionally followed by a dash and a region code in ISO 3166-1 alpha-2, such as en, ar, ar-AE or en-GB. A script code from ISO 15924 can sit in between, as in zh-Hant. A region on its own is not valid, and codes outside those lists, such as es-419, are not supported. Case does not matter, but writing the region in capitals is the ISO convention, so the tool writes ar-AE. Google says the reserved codes EU, UN and UK have no effect: for the United Kingdom use GB. For Arabic in the Gulf use ar-AE for the UAE, ar-SA for Saudi Arabia, ar-QA for Qatar, ar-KW for Kuwait, ar-OM for Oman and ar-BH for Bahrain, or plain ar for every Arabic speaker. Watch the traps: on their own, ae is the code for Avestan, sa for Sanskrit, kw for Cornish and om for Oromo, and ar-AR means Arabic for Argentina. The tool checks 183 language codes from the Library of Congress list and 249 region codes from the Debian iso-codes reprint of ISO 3166-1, because iso.org refused our connection.

x-default: the page for everyone else

x-default is a reserved value for visitors whose browser language matches none of your versions. Google recommends it for this fallback and says it was designed for language picker pages, where it works best, though any page can be used; it needs no language code. A common choice on a bilingual Gulf site is the English version or a page that lets visitors pick English or Arabic. The same x-default should appear in the set on every version, and the checker warns when pages name different ones. If you have regional pages for one language, such as en-GB and en-US, Google also suggests a plain en page for speakers of that language elsewhere, and the generator reminds you when it is missing.

Three formats: which one to choose

HTML tags suit most sites: every version carries the same block of link rel="alternate" tags inside its head, including one for itself. Google asks that the tags sit in a well-formed head section and that hreflang is not combined with other attributes such as media in the same tag. The HTTP Link header carries the same set in a response header and is the way to annotate PDFs and other files that have no HTML head. The sitemap method keeps everything in one file: each URL gets its own url entry, and each entry lists every version, itself included, as xhtml:link elements, with the xhtml namespace declared on the urlset. Those child links do not count toward the sitemap's URL limit, and a sitemap may only list URLs below the folder it is served from. The Bulk tab turns a spreadsheet of pages, one column per language, into such a sitemap in one step.

What the return-link checker looks for

The checker reads the pages you paste, or a sitemap, and builds a table of every hreflang link with its status. It never fetches pages, so copy each version's source from your browser, put a line with its URL above it, and paste them all. Errors stop Google from using the tags; warnings are likely mistakes. It also writes a corrected, complete set from the codes each page gives itself. To give AI assistants a short map of the site as well, build one with the llms.txt generator; for the title and description of each language version, use the meta tag generator. More checks are in our free SEO tools.

  • Missing return links: page A lists page B, but B does not list A
  • A version that does not list itself, and the same code used for two URLs
  • A page that calls itself ar-AE while another page calls it ar
  • Tags in the body instead of the head, and hreflang combined with media or type
  • A canonical pointing to another URL or another language: Google asks for a canonical in the same language
  • Relative, protocol-relative and http:// URLs, #fragments and tracking parameters
  • Invalid codes, en-UK, es-419, country codes used as languages, and pages that name different x-default URLs

Frequently asked questions

Do hreflang tags need return links?

Yes. Google says that if two pages do not both point to each other, their tags are ignored. Every version must list itself and all the other versions, so the same set of tags appears on each page. The Check tab finds every missing return link across the pages you paste.

Is this hreflang tag generator free and private?

Yes. The hreflang tag generator, bulk sitemap builder and checker are free with no sign-up, and they run in your browser: the URLs and page source you paste are not sent to our servers.

Should I write en-UK or en-GB?

en-GB. The ISO code for the United Kingdom is GB; UK is a reserved code, and Google says using it in hreflang has no effect on Search. The generator rewrites en-UK as en-GB and tells you it did.

Which hreflang code is right for Arabic in the UAE or Saudi Arabia?

Use ar-AE for Arabic speakers in the UAE and ar-SA for Saudi Arabia, or plain ar for every Arabic speaker. Do not use ae or sa alone: they are the language codes for Avestan and Sanskrit, not country codes.

Do I need hreflang in both the HTML and the sitemap?

No. Google treats HTML tags, HTTP headers and sitemaps as equal and says using more than one brings no benefit in Search, while making mistakes more likely. Pick the one that is easiest to keep correct on your site.

Related guides