hreflang Generator

Generate hreflang link tags.

FreeNo accountOn your device

Runs in your browser. How to verify

Loading tool…

About this tool

Type each language version as code|url, one per line, and press Generate. You get a link rel=alternate tag with hreflang for each version.

How to use

1
Step 1
Type one version per line as: code|url, for example en|https://example.com/.
2
Step 2
Press Generate.
3
Step 3
Paste all the tags into the head of every language version.

How it works

Each line is split at the first |. The part before it becomes the hreflang value and the part after becomes the href. Values are HTML-escaped. Codes such as en, fr or en-GB, and x-default, are written exactly as typed. The tool does not validate them, blank lines are skipped, and a line with no URL after the | gives an error. Every version must list all versions including itself.

Worked example

English and French

Input
en|https://example.com/ fr|https://example.com/fr/
Output
<link rel="alternate" hreflang="en" href="https://example.com/" /> <link rel="alternate" hreflang="fr" href="https://example.com/fr/" />
Walkthrough
One tag per line, using the code and URL you typed.

Limitations

  • Language and region codes are not validated.
  • Does not check that return links exist on the other pages.
  • Generates head link tags only, not sitemap hreflang entries.

Questions

How do I add hreflang tags?
Generate them and paste the full set into the head of each language version.
Do I need an x-default?
It is recommended for a fallback page. Add a line such as x-default|https://example.com/.
Does each page need all the tags?
Yes. Every version lists every version, including itself.

Features

  • One tag per line
  • HTML-escaped output
  • Runs in your browser

Related resources

Guides and videos from around the web—opens on YouTube or the publisher’s site.

  • Google Search Console Training trailer

    Google Search Central

    Series overview for Search Console workflows.

    Watch on YouTube
  • HTML Crash Course For Absolute Beginners

    Traversy Media

    Title/meta tags live in HTML these SEO tools preview.

    Watch on YouTube
  • Schema.org

    Schema.org

    Vocabulary for JSON-LD generators on SEO pages.

  • Sitemaps overview

    Google Search Central

    When sitemap and URL tools matter for discovery.