---
type: "Tool"
title: "hreflang tag generator: HTML and XML sitemap tags"
description: "Enter your language versions' URLs to get hreflang tags, x-default included, as HTML and as an XML sitemap, with a reciprocity reminder."
url: "https://www.roicool.com/en/tools/hreflang-generator"
lang: "en"
dateModified: "2026-11-18"
resource: "https://www.roicool.com/en/tools/hreflang-generator"
alternates:
  tr: "https://www.roicool.com/araclar/hreflang-olusturucu.md"
generated: { by: "process:roicool-cms", at: "2026-11-18T00:00:00.000Z" }
related:
  - { title: "International SEO", resource: "https://www.roicool.com/en/services/international-seo.md" }
  - { title: "Tools", resource: "https://www.roicool.com/en/tools.md" }
---

# hreflang tag generator. Is Google showing the right language version?

The hreflang tag tells Google about the language or regional versions of the same page, so search results show the version that fits the visitor's language. Each version must list itself and every other version. This tool builds the full set from the URLs you enter, x-default included, as HTML and as an XML sitemap.

## How it works Every version lists itself and all the others.

- HTML: \<link rel="alternate" hreflang="language-code" href="URL" /> (in every page's \<head>, for all versions)
- Sitemap: under each \<url>, an \<xhtml:link rel="alternate" …> for every version, itself included
- x-default: the page for visitors who match no language

How to use it: add a row per language version and enter the page's full URL and its language code. A code is a language (en, de) with an optional region (en-GB, de-AT); a country code alone is invalid.

Add the whole HTML block to every page listed. The tags must be reciprocal: if page A points to B but B does not point back to A, Google ignores both.

HTML tags, HTTP headers and the sitemap are equivalent for Google; one is enough, and using all three brings no extra benefit. For many pages the sitemap is easier to maintain.

## Limits

- The tool does not check that the pages you enter exist or carry the return tags; it only generates the tags.
- Every page needs its own set: this output covers the language versions of one page.
- hreflang is a signal, not a redirect; Google can still show another version based on other signals.
- Each page's canonical tag should point to itself; a canonical that points to another language version conflicts with hreflang.

## Official sources (last checked: 18 November 2026)

- \[Google Search Central: Tell Google about localized versions of your page\](https://developers.google.com/search/docs/specialty/international/localized-versions)
- \[Google Search Central: Managing multi-regional and multilingual sites\](https://developers.google.com/search/docs/specialty/international/managing-multi-regional-sites)

## FAQ

### What is x-default for?

It names the page to show when no version matches the visitor's browser language. It is usually a language selector or the main language version. It is not required, but it is recommended.

### Which language code should I use?

The ISO 639-1 code for the language (en, de, tr) and, if you add a region, the ISO 3166-1 Alpha 2 code (en-GB, pt-BR). "UK" is not a valid region code; the United Kingdom is "GB".

### Do I need the tags on every page?

Yes. Every language version must list all versions, itself included. A tag missing on one version invalidates hreflang for that pair.

### HTML or sitemap?

They are equivalent for Google. HTML tags are simple for a few pages; with hundreds of pages a sitemap keeps the page size down and is managed in one place.

Breadcrumb: [Home](https://www.roicool.com/en) › [Resources](https://www.roicool.com/en/resources) › [Tools](https://www.roicool.com/en/tools) › hreflang tag generator

Related pages:

- [International SEO](https://www.roicool.com/en/services/international-seo)
- [Tools](https://www.roicool.com/en/tools)

**Let’s set up your language and country architecture.** We draw up a plan for hreflang, URL structure and localized content. [Our international SEO service](https://www.roicool.com/en/services/international-seo)

Source: https://www.roicool.com/en/tools/hreflang-generator · Last updated: 2026-11-18
