Hreflang Tag Validator

Validate your hreflang tags to ensure proper international SEO implementation. Our tool checks for correct language and region codes, identifies missing return tags, detects duplicate entries, and helps you avoid common hreflang mistakes that can impact your global search visibility.

Paste HTML
Check URL

Similar Tools

What Are Hreflang Tags and Why Does Your Website Need Them?

Hreflang tags are like road signs for search engines. They tell Google which version of your website should appear to visitors in different countries. Maybe you have three different versions of the same product page. One in English for the US market, another in Spanish for Mexico and a third in Portuguese for Brazil. Search engines need to know which one each visitor should see.

Google has to make educated guesses about which page to show when these tags aren't in place. The problem is that these guesses are usually wrong. You may have built a great Spanish page specifically for your Mexican customers. Google might still send them to your English page by mistake. Most of these visitors will leave right away. And I can't blame them.

Duplicate content penalties are another issue that hreflang tags help you avoid. When search engines see multiple pages with similar content and they might assume you're trying to manipulate rankings. Hreflang tags give the context that explains why you need all these similar pages in the first place. They're legitimate variations for different audiences - not an attempt to game the system.

Skipping these tags can lead to pretty harsh consequences for your business. Businesses lose between 30% and 50% of their international organic traffic because the wrong page versions show up in search results. Half of your customers could be landing on pages in the wrong language! Or maybe they're seeing prices in a currency that they don't use and it's just as bad for conversions.

Big businesses like Amazon and Booking.com depend heavily on hreflang tags to serve millions of users around the world. A customer in Japan doesn't want to see prices in US dollars or shipping times from American warehouses. Regional pricing needs to be accurate for each market that you serve. Local shipping options also have to make sense. Legal requirements change quite a bit from one country to the next and your pages need to account for all these differences.

What Is the Proper Format for an Hreflang Tag?

Hreflang tags are a pretty simple way to communicate with search engines about which language and country each of your pages should target.

A typical hreflang tag has an easy format that looks like this - hreflang="en-US". The first part of the tag tells the search engines what language your page uses and it does this with what's called ISO 639-1 codes. The "en" stands for English in this example. The second part after the hyphen shows which country you're targeting and it uses ISO 3166-1 Alpha-2 codes for this. The "US" portion means the United States. What this tag does is tell search engines that this particular page should be served to English speakers who are located in the United States.

You can definitely use a language code all by itself without any country attached to it. A tag that reads hreflang="es" will target all Spanish speakers no matter where in the world they happen to be located. hreflang="es-MX" specifically targets Spanish speakers who are in Mexico and hreflang="es-ES" targets Spanish speakers in Spain. These distinctions are actually quite useful to have because Mexican Spanish and Spain Spanish can have big differences in vocabulary, grammar and even cultural references.

One particular tag worth your attention is called x-default. This functions as your fallback option for all visitors. Whenever a visitor arrives at your site from a country or in a language that you haven't specifically covered with other hreflang tags, the x-default page is what the search engines will serve them. Most websites usually choose their main English page for this role though you can use whatever makes the most sense for your audience.

The setup gets a bit more complex because each and every hreflang tag needs to have a reciprocal relationship. What this means is that if your English page has a tag that links to your Spanish page, then that Spanish page needs to include a tag that points back to your English page. Also each page needs to include a self-referential tag. I know that it sounds redundant but your English page actually does need to tell search engines that it's the English page.

Great Britain needs to be tagged as "GB" instead of "UK" in hreflang tags and this trips up a lot of site owners. Another common error is mixing up the order of language codes and country codes. The language code always needs to come first, followed by the country code if you're using one.

How Do You Add Hreflang Tags to Your Site?

Once you have the syntax figured out and you feel comfortable with how e these tags work, it's time to actually set them up on your site. To get them on your site, you have three different options and the one that makes the most sense for you depends on what type of website you're running.

One strategy is to just put hreflang tags directly in the HTML head section of each page. The tags go between the opening and closing head tags on every page of your site. For smaller websites with maybe a dozen pages or so, it's easy. But scaling can be a nightmare. Every time you add a new language version to your site, you have to go back and manually update every page with the new hreflang information. Websites with thousands of pages across multiple languages have their work cut out for them.

XML sitemaps give you a better way to manage this for bigger websites with complex language structures. Instead of adjusting each page's code, you can manage all your hreflang data from one single XML file. Google has actually come out and said they like it for large-scale websites because it's more efficient from a technical standpoint. The beauty here is that you can update language connections and add new versions without ever having to touch the HTML code on your pages.

The HTTP header method also exists, though most site owners will never need to use it. This method is specifically designed for PDFs, image files and other non-HTML content that can't accommodate standard meta tags in a head section.

Performance problems come into play as you start to compare these different methods. Sites with twenty or more language versions can experience real slowdowns if they're sticking with the HTML setup. Every hreflang tag adds another line of code to your page header, and these extra lines can start to add up fast in terms of page weight and load time. The XML sitemaps solve this problem by keeping all that bulk out of your page code.

For small websites with just a handful of pages and maybe two or three language versions, the HTML setup remains perfectly viable. Once your site grows to hundreds or thousands of URLs spread across multiple languages though, the XML sitemaps become the only sensible option from a maintenance and performance perspective.

Which Hreflang Mistakes Can Wreck Your Setup?

A lot of site owners who try to set up hreflang tags manually are going to break them and they won't even know what went wrong. The number one mistake I see is when a webmaster sets up their English page to point to their Spanish page with an hreflang tag. But then they forget that the Spanish page needs to point back to the English one as well. These are called return links. Missing even a single one of them means Google says "nope" and throws out your entire setup. All that hard work just disappears.

Another big issue pops up when the URLs for your different language versions don't actually match one another properly. Your English page might live at /products/shoes while your French version is hiding out at /fr/produits/chaussures. Search engines will look at this type of inconsistency and have a hard time figuring out which pages are actually supposed to be connected to one another.

Canonical tags create their own particular brand of chaos too. You could have a canonical tag on your page that refers to one URL. But then your hreflang tags are telling search engines that a different page is the right version for that language. Search engines see these mixed messages and throw their hands up in frustration. Some site owners also make the mistake of redirecting their hreflang URLs or they use relative paths instead of full URLs. Either choice will cause your entire hreflang setup to collapse. The same problem happens when the pages don't have real equivalents in other languages. A blog post about Thanksgiving isn't going to resonate with your German audience who doesn't celebrate that holiday, so a direct translation just won't work!

Once any of these mistakes creep into your setup Google stops trusting your hreflang tags and goes back to its own methods for figuring out which pages to show in different countries and all that careful work you did ends up worthless because of one small error.

Which Tools Make Hreflang Tags Easier?

Bidirectional links across multiple pages can get pretty challenging. Every German page has to point back to its English counterpart and the English page has to return the favor. Even one missing link can throw search engines for a loop and they won't know which version belongs in which region. Hreflang generators are the answer to this whole mess. These tools take care of all that reciprocal linking automatically. No more double-checking every tag. No more worrying about whether you remembered to add those self-references that everyone seems to forget.

A few solid generators are out there that won't cost you a dime. Aleyda Solis has built a simple generator that covers the main features that most sites need. Merkle's Technical SEO suite goes a step deeper with extra options for large company websites. Sistrix actually gives you a generator and a validator bundled together in the same tool. The process couldn't be much easier. You just paste in your URLs and pick the right language codes for each one. The generator then spits out the formatted tags for every page in your collection and includes those important self-referencing tags automatically so each page correctly links to its alternate language versions without you having to worry about it.

Bigger websites get even more help from bulk processing features. Most generators let you upload a CSV file with hundreds of URLs and their corresponding language codes all at once. The tool validates your language codes and hands you back a set of tags that are ready to go straight into your site. Some of the fancier tools will even plug directly into your content management system. Large company teams usually get API access for smooth integration.

Of course, the generators have their limits. They can't magically fix it if your URL structures are all over the place across different language versions. They also have no way to tell if two pages are legitimate translations or different content. That verification step is still on you. Make sure that your pages actually match up before you tell search engines they're connected!

How Do You Make Sure Your Hreflang Setup Works?

Generators can create perfect-looking hreflang tags that don't actually work the way they're supposed to. A lot of website owners run into big problems at this stage because validation is the part that matters most in the whole process.

Google Search Console has an International Targeting report that's specifically designed to catch hreflang errors across your entire website. It'll flag all sorts of problems like missing return links or incorrect language codes. The URL Inspection tool is also very useful for checking individual pages. You just paste in any URL from your site and Google tells you how it interprets each of your hreflang tags on that page.

For more complete analysis, you'll probably want to use dedicated tools. Screaming Frog has great built-in hreflang audit features that crawl through your entire site and automatically flag any syntax errors they find. Another useful resource is hreflang.org that specializes in catching return link problems. These are especially hard-to-find errors where your English page correctly links to your Spanish page but the Spanish page fails to correctly link back to the English version.

The frustrating reality with hreflang setup is that it's very fragile. Every time you add new pages to your site or make changes to your URL structure, you're in danger of accidentally breaking something in your hreflang setup - which is why the automated alerts in Search Console are so valuable. If your error rate suddenly spikes, you'll know about it right away.

Beyond technical validation, you really need to test the scenarios too. Verify that a person searching from Mexico actually sees your es-MX pages in their search results. Double-check that your x-default tag correctly catches visitors from countries you haven't specifically targeted yet. These tests usually reveal problems that even the best technical validators won't catch!

What Does the Hreflang Validator Actually Check?

The tool reads every link tag on the page that has rel="alternate" and an hreflang attribute, then runs each one through a handful of checks. It confirms that the language and region code is formatted correctly, that the URL is a complete and valid address, that no hreflang value appears twice, and that you aren't pointing two different languages at the same URL. It also looks at the set as a whole and warns you when the x-default tag is missing or when there's only a single tag on the page, which usually means the setup isn't finished.

Every tag gets a status of valid, warning or invalid along with a short note explaining the problem. The summary at the top of the results gives you the counts so you can see at a glance whether the page is clean or needs work.

Should I Paste My HTML or Enter a URL?

Either one works and the checks are the same. Enter a URL when the page is already live and you want to see exactly what a crawler would find. The validator fetches the page for you and reads the tags out of the delivered HTML. Paste the HTML when the page isn't public yet, lives on a staging server behind a login, or when you just want to test a block of tags you generated before you add them to your site. You don't need the whole page in the paste box. The head section, or even just the link tags, is enough.

Does This Tool Check Return Links on My Other Pages?

No. The validator looks at one page at a time and checks the tags on that page. It doesn't follow each URL to confirm that the alternate page links back to the original. Return links are the single most common reason an hreflang setup fails, so you still need to check them. The quickest way is to run the validator on each page in the set and compare the lists. If your English page lists five alternates, each of those five pages should list the same URLs, including a self-referencing tag for its own address. For sites with hundreds of pages, a crawler like Screaming Frog or the International Targeting report in Google Search Console will catch missing return links in bulk.

Why Is My Language Code Flagged as Invalid?

The validator accepts a two or three letter language code, optionally followed by a hyphen and a two letter country code, plus the special value x-default. Most invalid results come from one of a few habits. Using an underscore instead of a hyphen (en_US) will fail. Putting the country first (US-en) will fail. Using "UK" for the United Kingdom fails too because the ISO country code is GB. A country code on its own with no language, like "DE" by itself, is also invalid because every tag needs a language.

One thing to be aware of: the tool doesn't currently recognize script subtags such as zh-Hant or zh-Hans-TW, so those will show as invalid even though Google supports them. If that's the only issue on a tag that uses a script code, you can safely ignore the flag.

Do I Really Need an x-default Tag?

It's not strictly required, but the validator warns you when it's missing because skipping it leaves a gap. Without x-default, Google has to guess which version to show someone whose language and country you haven't covered, and it will often pick the wrong one. Point x-default at the page you'd want a stranger to land on, which for most sites is the main English version or a language selector page. It counts as one of your alternates, so include it on every page in the set just like the other tags.

My Hreflang Lives in the XML Sitemap. Will the Validator See It?

Not from the URL fetch, since that only reads link tags in the page's HTML. Sitemap-based hreflang is perfectly valid and Google reads it just fine, but the tags aren't on the page itself. If you use the sitemap method, check it in Google Search Console or with a crawler that parses sitemap annotations. You can still use this tool to test a page where you've added tags to the head directly, which is handy if you run a mix of both methods.

How Often Should I Re-Check My Tags?

Run the validator any time you add a new language, change a URL structure, migrate a site, or switch to a new CMS or plugin. Those are the moments when tags quietly break. A quick monthly spot check of a few key pages is also a good habit, because a theme update or plugin change can strip or duplicate tags without anyone noticing until international traffic starts to drop.

Let's Grow Your Business

Want some free consulting? Let's hop on a call and talk about what we can do to help.