Hreflang Tag Generator
Add one row per language or region with its page URL and get a ready-to-paste block of hreflang link tags. Set an optional x-default for users whose language you do not target, and every href is escaped for you.
How to generate hreflang tags
- Add a row for each localized page with its language code (like en-US) and full URL.
- Optionally set an x-default URL for visitors whose language you do not match.
- Copy the generated tags and paste them inside the <head> of every page in the set.
Examples
English and Spanish pages
en-US: https://example.com/, es-ES: https://example.com/es/
<link rel="alternate" hreflang="en-US" href="https://example.com/" /> <link rel="alternate" hreflang="es-ES" href="https://example.com/es/" />
Adding an x-default fallback
en: https://example.com/en/, x-default: https://example.com/
<link rel="alternate" hreflang="en" href="https://example.com/en/" /> <link rel="alternate" hreflang="x-default" href="https://example.com/" />
Frequently asked questions
What do hreflang tags do?
They tell search engines which version of a page to show for a given language and region. If you have the same content in English, Spanish and French, hreflang links the three versions so each is served to the right audience instead of competing with each other.
What is the x-default value for?
x-default marks the page to show when no other language or region matches the user. It is commonly used for a language selector or a global landing page. It is optional, but recommended when you target several languages.
Do hreflang tags need to be reciprocal?
Yes. Every page in a set should list all the alternates, including a self-referencing tag pointing to itself. If page A points to page B but page B does not point back to A, search engines may ignore the annotations entirely.
What format should the language code use?
Use a two-letter ISO 639-1 language code such as en or de, optionally followed by a hyphen and a two-letter ISO 3166-1 region code such as en-US or pt-BR. This tool flags codes that do not match that loose pattern so typos are caught early.
What are the most common hreflang mistakes?
The frequent ones are using an underscore instead of a hyphen (en_US), forgetting the self-referencing tag, listing relative instead of absolute URLs, and leaving the set non-reciprocal. Pages should also return a 200 status, not redirect to one canonical version.
Is my input sent to a server?
No. The tags are built entirely in your browser with JavaScript, so the languages and URLs you enter are never uploaded or stored.
Related tools
Canonical Tag Generator
Generate a clean rel=canonical link tag from any URL. Strip tracking params, force HTTPS and lowercase the host, then copy the tag. Runs in your browser.
Meta Tag Generator
Generate clean HTML meta tags for any page. Set title, description, keywords, author and robots, then copy the head block. Runs in your browser.
Article Schema Generator
Generate Article, NewsArticle or BlogPosting JSON-LD schema. Add headline, author, publisher and dates, then copy the script into your page.
Breadcrumb Schema Generator
Build BreadcrumbList JSON-LD structured data. Add your breadcrumb trail, reorder the steps, then copy or download the script for your page.
Bulk Hreflang Generator
Generate hreflang annotations for many languages at once. Add language and URL rows, pick HTML, XML sitemap, or HTTP header output. Runs in your browser.
Canonical Tag Checker
Paste page HTML to find every rel=canonical link and catch issues: missing, duplicate, relative or wrong-target canonicals. Runs in your browser.