Sign up free

Hreflang Tag Generator

List every language version of a page and get hreflang tags in the format you need.

About Hreflang Tag Generator

Hreflang tells search engines which language or regional version of a page to show, so a reader in Germany gets the German page and a reader in Taiwan gets traditional Chinese. Add one row per version with its language code, optionally followed by a region (en, en-GB, zh-TW), and its URL, plus an x-default page for everyone else. The generator validates the codes, flags duplicates and reminds you that each page has to list itself too.

You get three formats: link tags for the head of each page, xhtml:link entries for your XML sitemap, and HTTP Link headers for PDFs and other files without a head. One method is enough, but every version needs the full set, because hreflang only counts when the pages point at each other. It all runs in your browser, and nothing is uploaded.

How to use Hreflang Tag Generator

  1. 1
    Add each version

    Enter a language code, adding a region if you target one country, and the URL of that version.

  2. 2
    Set x-default

    Choose the page for visitors whose language isn't listed, such as a language picker or your main version.

  3. 3
    Fix any warnings

    Correct invalid codes and duplicates, and make sure the page's own version is in the list.

  4. 4
    Copy your format

    Take the link tags, sitemap entries or HTTP headers and add them to every version.

Why use Cubfile for this

  • Three formats

    HTML link tags, XML sitemap xhtml:link entries and HTTP Link headers.

  • Code checks

    Invalid language and region codes and duplicate entries are flagged.

  • x-default included

    A fallback page for every language you don't cover.

  • In your browser

    Free, not counted as a task, and nothing is uploaded.

FAQ

Hreflang Tag Generator: questions and answers

What codes does hreflang use?
A two-letter ISO 639-1 language code, optionally followed by an ISO 3166-1 region code, such as de, en-GB or zh-TW. A region on its own isn't valid, and the United Kingdom is GB, not UK.
What is x-default in hreflang?
The version shown to people whose language or region matches none of your tags, usually a language picker or your main international page.
Does each page need an hreflang tag pointing to itself?
Yes. Every version should list all versions, itself included, and the others must link back. Otherwise search engines may ignore the tags. Each version's canonical tag should point to itself too, which the Meta Tag Generator can write.
Should I use link tags, the sitemap or HTTP headers?
Any one of them works. Link tags suit most sites, the sitemap is easier when you can't edit page templates, and HTTP headers are for PDFs and other non-HTML files. To build the sitemap itself, use the XML Sitemap Generator.
Does hreflang improve rankings?
No. It helps search engines show each reader the right language version rather than raising positions. Google and Yandex support it.
Share Hreflang Tag Generator with a friendIt runs in any browser, and they can try it without signing up.

Related tools

XML XML Sitemap GeneratorCrawl your site or paste a list of URLs to build an XML sitemap.
HTML Meta Tag GeneratorWrite title, description and robots tags with live length checks and a preview.
TXT Robots.txt GeneratorCreate a robots.txt with presets for search engines and AI crawlers.
JSON Schema Markup GeneratorGenerate JSON-LD for FAQ, articles, products, organizations and more.
HTML Open Graph GeneratorMake Open Graph and Twitter Card tags and preview the share card.
CONF 301 Redirect GeneratorGet redirect rules for Apache, Nginx, IIS, PHP and HTML.
URL UTM Link BuilderAdd UTM tags to links so you can track campaigns in analytics.
CONF Htpasswd GeneratorCreate .htpasswd lines for Apache and Nginx basic authentication.