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 to use the free hreflang tag generator
- 01
List each version: language (and optional region) code, then its URL.
- 02
Add the x-default fallback URL.
- 03
Add the same tags to every version, or use the sitemap format.
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 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.
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
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.
Related free SEO tools
All 87 free toolsSchema Markup Generator
Pick a schema type, fill in the details, and copy valid JSON-LD structured data for your page.
FAQ Schema Generator
Paste your questions and answers to get valid FAQPage JSON-LD you can add to the page.
Meta Tag Generator
Fill in your page details to generate every essential meta tag: title, description, robots, canonical, Open Graph and X (Twitter) cards.
Local Business Schema Generator
Generate LocalBusiness structured data with your address, phone, opening hours, map coordinates and social profiles, for any type of local business.
Product Schema Generator
Generate Product structured data with price, stock, brand, SKU and ratings, so Google can show price and availability in search results.
Open Graph Generator
Fill in the title, description and image you want people to see when your link is shared, and copy the Open Graph tags.
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