Skip to content
fixyour.page

Hreflang Generator

Create hreflang tags for multi-language and multi-region sites.

Your data stays in your browser
Language Version
Optional. Use when targeting a specific country.
Full URL of this language version.
Fallback URL when no language matches the user.
Hreflang Tags
<!-- Fill in the form above -->

How to Use the Hreflang Generator

Add a language version for each translation of your page. Pick the language, optionally pick a region, and paste the full URL. The generator builds the <link rel="alternate"> tags you need. Copy the output and drop it into your page's <head>.

Set an x-default URL if you have a language-neutral landing page or want to control what users see when none of your specified languages match. Every tag is generated with properly escaped attributes, so the markup is always valid HTML.

What Are Hreflang Tags?

Hreflang tags tell search engines which language and regional version of a page to show in results. If you have an English page and a Spanish page covering the same content, hreflang tags prevent Google from picking the wrong one for a given user. Without them, your Spanish page might show up for English searchers, or vice versa.

They're essential for any site serving content in multiple languages or targeting different countries with the same language (English for the US vs. English for the UK, for example). Search engines don't guess well here. Tell them explicitly.

Common Hreflang Mistakes

The most common mistake is forgetting reciprocal links. If page A points to page B with hreflang, page B must point back to page A. One-way hreflang tags get ignored. Second most common: using wrong language or region codes. It's en-GB, not en-UK. ISO codes aren't always intuitive.

Forgetting x-default is another frequent oversight. Without it, search engines have to guess what to show users who don't match any of your specified languages. That guess is usually wrong. Set an x-default and remove the ambiguity.

Link Tags, Sitemap, or HTTP Headers?

There are three valid ways to publish hreflang annotations, and Google treats them equally. The <link> tags this generator builds go in each page's head and are the easiest to debug, since you can view source and see them. XML sitemap annotations keep hreflang out of your templates entirely and scale better when you have thousands of pages or dozens of languages, because each new language means touching one file instead of every page. HTTP headers are the fallback for non-HTML files like PDFs.

Pick one method and stick with it. Publishing hreflang in two places invites the two to disagree, and conflicting annotations get ignored. For most sites under a few hundred pages, head tags are the right call.

One more thing worth knowing: hreflang is a Google and Yandex feature. Bing mostly relies on the content-language meta tag and its own geo-detection instead. If Bing traffic matters to you, set that tag too. It doesn't conflict with hreflang.

What is x-default and do I need it? +
The x-default tag tells search engines which URL to show when none of your specified languages match the user. Think of it as the fallback. If someone in a country you haven't targeted searches for your content, x-default is what they get. You don't strictly need it, but without it you're leaving that decision to Google. They won't always pick what you'd pick.
Do I need hreflang if I only have one language? +
No. Hreflang tags only matter when you have multiple language or regional versions of the same content. If your site is English-only, skip them entirely. Adding hreflang tags to a single-language site does nothing useful and adds unnecessary markup.
Should hreflang go in the HTML head or the sitemap? +
Both work. Putting them in the HTML <head> is simpler and easier to debug. Putting them in your XML sitemap scales better for large sites with hundreds of language variants. Pick one approach and stick with it. Don't mix both for the same pages.
What happens if hreflang tags have errors? +
Search engines silently ignore them. No penalty, no warning in most cases. Your pages will still rank, but the language targeting won't work. The wrong version might show up in the wrong country. Google Search Console will sometimes flag hreflang errors, so check there if things aren't working as expected.