Free Hreflang Tag Generator

List each language version of a page to generate correct hreflang tags, as HTML or as XML sitemap entries, including x-default.

Runs in your browser · nothing is uploaded

Before you publish

  • Add an x-default URL for visitors whose language isn't listed.
  • Hreflang needs at least two language versions.
  • Put the same full set of tags on every version of the page, including a tag for the page itself.

HTML: put in the <head> of every version

Or: XML sitemap entries

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">

</urlset>
How it works

How to use the free hreflang tag generator

  1. 01

    List each version: language (and optional region) code, then its URL.

  2. 02

    Add the x-default fallback URL.

  3. 03

    Add the same tags to every version, or use the sitemap format.

Guide

How hreflang works

Hreflang annotations tell Google which version of a page to show to speakers of each language or people in each region. Codes are an ISO 639-1 language (en, es, de), optionally followed by an ISO 3166-1 region (en-GB, es-MX). Note it's en-GB, not en-UK.

The full set of tags, including a tag pointing to the page itself, must appear on every version. Large sites often put hreflang in the sitemap instead of the HTML.

Tips

Tips for using the hreflang tag generator

Include every version, including itself

Each page lists all versions, including a tag pointing to itself.

Use region codes only when needed

"es" covers all Spanish speakers; "es-MX" only Mexico. Don't add regions you don't target.

Add x-default

Point x-default at a language selector or your main version.

Check the live pages

Validate the result with the hreflang checker.

Rankfly autopilot

Skip the manual work: get an article published to your site every day.

Rankfly finds the keywords your site can actually win, writes a full SEO article for each one, adds images, and publishes it to WordPress, Shopify, Webflow, Wix and more. Enter your website to see your free 30-day content plan.

3-day free trial · $66/month for 30 articles

FAQ

Hreflang Tag Generator FAQ

Do I need hreflang for one language?

No. It's only for sites with the same content in several languages or for several regions.

HTML or sitemap?

Either works. Sitemaps are easier to manage for many pages; don't mix both for the same URLs.

Is anything uploaded?

No. The code is generated in your browser.

Where do hreflang tags go?

In the <head> of each version, in the XML sitemap, or in HTTP headers for non-HTML files.

Is hreflang a ranking factor?

No. It helps Google show the right version to each searcher.

Can hreflang point to another domain?

Yes, for example example.com and example.de can annotate each other.

Start today

Let Rankfly do your SEO for you.

Enter your website for a free 30-day content plan: the keywords your site can win and the articles Rankfly would write and publish. About three minutes.

3-day free trial · $66/month after · Cancel anytime