Hreflang Tag Generator
Add each language version of a page with its address, then copy the link tags for the head of your pages or the lines for your sitemap.
Este contenido está en inglés.
Ejemplos resueltos
UK and US page versions
Row 1: en-GB at https://example.co.uk/; row 2: en-US at https://example.com/
<link rel="alternate" hreflang="en-GB" href="https://example.co.uk/" /> <link rel="alternate" hreflang="en-US" href="https://example.com/" />
Each row adds one link tag, which goes inside the head section of both pages so search engines can match the right version to each visitor.
French version of a page
Row 1: fr at https://example.fr/
<link rel="alternate" hreflang="fr" href="https://example.fr/" />
A language on its own, without a region, is valid, so the tag covers every French-speaking reader.
Sobre Hreflang Tag Generator
If your website has the same page in more than one language, or the same language written for different countries, search engines need help choosing the right version for each reader. Hreflang link tags do that job. Each tag names a language, such as en, and optionally a region, such as GB, then gives the address of the page written for that audience. Writing these tags by hand is slow and easy to get wrong, especially when a site has dozens of pages with several versions each. This tool lets you list each version in its own row, checks that the codes are two letters and the addresses are complete, and then builds the lines for you.
Once the lines are ready you can copy them into the head section of each page, or add them to your sitemap. The sitemap version uses the xhtml link element inside each page entry, which is useful when one file lists many pages. Every page in the set should carry the full list, including a link to itself, so that the connections run both ways. A default address is optional. It is used for visitors whose language or region is not in your list, and it appears as x-default in the output. Enter the addresses exactly as they appear on your live site, with the same scheme and any trailing slash, so the tags match the pages people actually visit.
Cómo usar Hreflang Tag Generator
- Type the language code for each version of the page, such as en or fr, in the language box.
- Add a region code, such as GB or US, if the page is written for a particular country. Leave the box empty otherwise.
- Paste the full address of that version of the page, starting with https://.
- Add a row for each version, and optionally a default address for visitors whose language is not in the list.
- Copy the head tags into each page, or copy the sitemap lines into your sitemap file.
Usos habituales
- A shop that sells in English for the UK, the US and Australia, with a separate price list for each.
- A charity that publishes the same guide in English and Welsh, with a default page for other visitors.
- A travel website with French and German versions of its destination pages, each linking to the others.
- A business that wants visitors whose language is not in its list to land on one main page.
Preguntas frecuentes
Do I need a region code?
No. A region code is only needed when the same language has different versions for different countries, such as English for the UK and English for the US. If each language has one version, a language code on its own is enough. Adding a region when the content does not really differ between countries can make the tags harder to keep up to date, so use one only where it matters.
What is the default page address for?
The default page address is used for visitors whose language or region does not match any row in your list. The tool writes it as a link with the value x-default. It is optional, and many sites point it at their main page or at a page that lets the visitor choose a language. Leave it empty if you do not have a sensible fallback page for everyone else.
Why does the tool reject my language code?
Language codes use exactly two letters, such as en for English, fr for French or cy for Welsh. A code with a region attached, such as en-GB, belongs in two separate boxes, with en in the language box and GB in the region box. Codes with three letters or any numbers are not accepted. The message beside the row says what needs changing, so correct that row and the tags will update straight away.
Should every page link to every other version?
Yes. Each version of a page should list the full set of alternatives, including itself. If page A links to page B but page B does not link back, search engines may ignore the connection. Use the same set of tags on every page in the group, and make sure each address is a real page that loads, so the links work in both directions and match what visitors see.
Where do I put the sitemap lines?
Place the lines inside the entry for each page in your sitemap file. The root element of the sitemap needs the xhtml namespace declared, which is written as xmlns:xhtml with the value http://www.w3.org/1999/xhtml. Each page entry should contain the full list of alternatives, the same as the head tags would. If your site builds its sitemap automatically, these lines can be added to the template that writes each entry.