Skip to content
gohacks.dev
Web

hreflang Tag Generator

Generate hreflang annotations for every language version of a page as HTML link tags, an HTTP Link header or sitemap entries, with code and x-default checks.

Free · No sign-up · Your inputs stay in your browser

Input

Generate hreflang tags

Output

hreflang

389 characters

Every version must list every other version and itself, with the same set on each page; a link that is not returned from the other side is ignored. Use one method per site: HTML for pages, the HTTP header for PDFs, the sitemap when there are many languages. hreflang chooses which URL to show, not which to rank, and it needs each version to be the canonical of itself.

Runs in this browser. Nothing you paste is sent to a server.

Every page lists every page

hreflang works in both directions: each version must list all versions including itself, with identical sets on every page. A version that is not linked back is ignored. Each version must also be its own canonical, or the hreflang points at a URL that is not indexed. Google's localized versions guide covers the rules.

Choosing a method

Link tags in the head are simplest for HTML pages, the HTTP header suits PDFs and other files, and sitemap annotations keep pages light when there are many languages. Use one method per site.

Share

Frequently asked questions

What is x-default?
The version for visitors whose language matches none of the listed ones, often a language selector or the English page.
Is en-UK a valid hreflang code?
No. The ISO 3166 code for the United Kingdom is GB, so use en-GB. Invalid codes are ignored.
Is what I paste sent anywhere?
No. The tool runs entirely in your browser with JavaScript. Nothing you type or paste is sent to our server or stored.

Keep planning

Similar tools