Skip to content
Devtoolry

Hreflang Generator

Generate hreflang tags for your language and country versions as HTML link tags, XML sitemap entries or an HTTP Link header, with every code validated as you type.

Runs in your browser · Nothing uploaded · No sign-up

Something not working, or missing a feature? Send feedback

About the Hreflang Generator

The Hreflang Generator builds the hreflang annotations for a page that exists in several languages or countries. Add one row per version (language code, optional country, URL) plus x-default, and copy the result in the format you need: link tags for the HTML head, url entries with xhtml:link alternates for an XML sitemap, or an HTTP Link header for PDFs and other files. Codes are validated as you type.

Files and tags are generated in your browser; nothing you enter, including unpublished URLs and titles, is sent to a server.

How to use the Hreflang Generator

  1. Add a row for each language or country version with its full URL.
  2. Add x-default for visitors whose language is not listed.
  3. Pick HTML, XML sitemap or HTTP header, and copy the output.
  4. Put the same set on every version, then confirm with the Hreflang Checker.

Works well with the Hreflang Generator

Frequently asked questions

HTML tags, sitemap or header: which should I use?

All three work equally for Google; pick the one that is easiest to keep correct. HTML tags suit small sites, the sitemap suits large sites with many versions (it keeps the HTML light), and the HTTP header is the only option for non-HTML files such as PDFs.

Do I need a separate tag for every country?

Only if the content differs. A language code alone (es) covers all Spanish speakers. Add regions (es-ES, es-MX) when prices, spelling or offers differ by country.