Skip to content

Hreflang Validator

Check hreflang tags you type, one per line. en is valid. english is not. The page does not fetch a site.

Result

Enter hreflang tags

How to Use

  1. 1 Enter up to 20 tags, one per line.
  2. 2 Choose Check the tags.
  3. 3 Read which lines are valid. en is valid. english is not.

Example Output

  • en is valid.
  • en-US is valid.
  • english is not valid.

About This Tool

A tag is a language of 2 or 3 letters, optionally followed by a hyphen and 2 to 8 letters or digits. x-default is also accepted.

Using the Hreflang Validator

This page checks hreflang tags you type, one tag per line. It does not fetch a site, and it does not request the pages a tag might point to. The field starts as two lines, en and en-US. Both of those pass, so the headline is 2 of 2 valid. The text under the headline is en: valid and then en-US: valid. The Valid line reads 2. The Invalid line reads 0.

Replace the second line with english and the headline becomes 1 of 2 valid. The text is en: valid and english: invalid. The Valid line reads 1 and the Invalid line reads 1. english fails because a tag is 2 or 3 lowercase letters, optionally a hyphen and 2 to 8 letters or digits, unless the whole line is x-default. english is longer than three letters and has no hyphen of that shape.

x-default is valid on its own line. It is accepted as that exact spelling. EN is invalid, because the language letters must be lowercase. A line that is only en- is invalid, because the hyphen is not followed by 2 to 8 letters or digits. The page is checking the shape of each line. It does not look the tag up in a catalog of language names, so a two-letter lowercase string passes the shape even when you would not publish it as a language.

Up to 20 tags are allowed. Blank lines are dropped before the count, so a blank line between en and english does not become a third tag. More than 20 tags, or a field that is empty after blank lines are dropped, is rejected with Enter from 1 to 20 tags. The button is labeled Check the tags. The waiting line reads Enter hreflang tags. Copy result copies the line list, such as en: valid and english: invalid, not the headline 1 of 2 valid. The page that builds link tags is a different page. The label above a successful headline reads Hreflang tags. The button that runs the check is labeled Check the tags.

What 1 of 2 Valid Means

The headline counts the lines that passed and the lines that were checked. For en and english it reads 1 of 2 valid. That is one pass and one failure, which the lines under the headline also split: Valid is 1 and Invalid is 1. The copied text is the per-line report, en: valid followed by english: invalid. The headline is the summary. Copy result does not copy the summary. If you need both, copy the report and write the headline beside it.

How a Line Passes or Fails

Each remaining line is tested on its own. x-default passes only when the line is exactly x-default. Every other line must be 2 or 3 lowercase letters, or that same language plus a hyphen and 2 to 8 letters or digits. en passes. en-US passes. en-us passes, because the part after the hyphen may be uppercase or lowercase. english fails. EN fails. en- fails. A second hyphen, as in a line with two hyphens, fails because the shape allows only one optional group. The page does not correct EN into en, and it does not shorten english into en.

Building the link elements is a different page. The Hreflang Generator writes alternate link tags from a page URL, a language, and one alternate per line. You can add an x-default URL when one page should be the fallback. It writes the link elements. It does not submit them to a search engine, and it does not score a pasted list with a headline such as 1 of 2 valid. Use it when you want the tags written. Use this page when you already have tag lines and want each line marked valid or invalid.

What a Valid Shape Does Not Claim

A line marked valid has the accepted shape, or it is x-default. It is not a promise that a search engine will use it, and it is not a promise that a page in that language exists. The page does not fetch a site. en can be valid in this checker while the URL you meant to annotate is still missing, because this page never asked for a URL. The report stops at the tag text.

en, english, en-US, and x-default

Leave the field as en and en-US. Choose Check the tags. The headline is 2 of 2 valid. Valid is 2. Invalid is 0. The report is en: valid and en-US: valid. Replace the second line with english. The headline is 1 of 2 valid. Valid is 1. Invalid is 1. The report is en: valid and english: invalid. Put x-default on its own line and the headline is 1 of 1 valid. Add EN under en and the report marks en valid and EN invalid. Add a line that is only en- and that line is invalid. Clear the field and confirm Enter from 1 to 20 tags. Put the starting pair back afterward if the pair you mean to keep is en and en-US, which is 2 of 2 valid.

A JSON-LD object is a different page. The Schema Markup Generator builds one JSON-LD object from a type, a name, and a description. The page does not publish the markup, and it does not claim that a search engine will use it. It does not score hreflang lines, and it does not return a headline of 1 of 2 valid. Use it when the task is that JSON-LD object. Use this page when the task is the shape of hreflang tags, one per line.

Twenty Lines and the Shape of One Tag

The page accepts from 1 to 20 tags after blank lines are removed. One tag is enough. Twenty tags are allowed. Twenty-one tags are rejected with Enter from 1 to 20 tags, and no partial report is returned. A field that is empty, or that contains only blank lines, is rejected with that same message. A blank line between en and english does not count, so those two tags are still 1 of 2 valid.

Mistakes that Misread Valid

A common miss is to treat english as close enough to en. The report marks english invalid. The page will not shorten it. Another miss is to type EN and expect the lowercase sample to cover it. EN is invalid. A third is to read 1 of 2 valid as "the set failed" or as "the set passed." One line passed and one line failed. The report names them. A fourth is to expect the page to open the site and look for link elements. It does not fetch a site. A fifth is to paste a full link element and expect the attributes to be parsed. Each line is read as a tag, not as HTML. A line of markup is judged by the same shape, and a long element will not match en.

A robots file is a different page. The Robots.txt Generator builds a robots.txt file from a user agent, a disallow path, an optional allow path, and an optional sitemap URL. The page does not upload the file. It does not check hreflang tags, and it does not return a count of valid lines. Use it when the task is that file. Use this page when the task is the tag lines.

Saving the Report, Not Only the Headline

Copy the report and write the headline next to it. For the sample that mixes a pass and a failure, the note should contain 1 of 2 valid, then en: valid, then english: invalid. The headline without the report cannot tell a later reader which line failed. The Valid and Invalid lines are the same split as the headline, so 1 and 1 beside 1 of 2 valid is consistent. If they disagree with a report you copied earlier, run the check again before you file it.

Rebuilding 1 of 2 Valid

Enter en and en-US and confirm 2 of 2 valid, with both report lines marked valid. Replace the second line with english and confirm the headline 1 of 2 valid, the report en: valid and english: invalid, Valid 1, and Invalid 1. Enter x-default alone and confirm 1 of 1 valid. Enter EN and confirm it is invalid. Enter en- and confirm it is invalid. Clear the field and confirm Enter from 1 to 20 tags. Reset and confirm the field returns to en and en-US and the headline returns to Enter hreflang tags. Check en and english once more before you file a longer list.

A length check against 160 characters is a different page. The Meta Description Length Checker counts the characters in a meta description against a limit of 160. Hello is 5 characters, with 155 remaining. The page does not publish the description. It does not mark a line valid or invalid as an hreflang tag, and it does not know x-default. Use it to count a description. Use this page to check tag lines.

The Headline, the Report, and the Fetch

en with english is the check that shows a split result: the headline 1 of 2 valid, and the report naming en as valid and english as invalid. en with en-US is the check that shows a clean pair. x-default is the check that shows the extra accepted spelling. EN and en- are the checks that show case and a bare hyphen failing. An empty field is the check that shows the 1 to 20 limit message.

Changing One Line at a Time

Confirm en and en-US first. The headline should be 2 of 2 valid. Then change only the second line to english. The headline should become 1 of 2 valid, and the report should name english as invalid while en stays valid. If both lines flip, more than the second line changed. Restore en-US and confirm 2 of 2 valid again. A one-line check of x-default should be 1 of 1 valid. The label above the headline should stay Hreflang tags through those checks. Change one line at a time so a new invalid row has one cause.

Stripping tracking parameters is a different page. The URL Cleaner removes parameters whose names start with utm_, along with fbclid, gclid, mc_eid, igshid, and si. The sample https://example.com/page?id=2&utm_source=news becomes https://example.com/page?id=2. Other parameters stay. The page does not open the link, and it does not judge an hreflang tag. Use it when the task is a web address with those parameters. Use this page when the task is the tag list.

Frequently Asked Questions

What does en plus english return?

The headline is 1 of 2 valid. The report is en: valid and english: invalid. Valid is 1 and Invalid is 1.

Are en and en-US valid?

Yes. Together they are 2 of 2 valid. The report marks both lines valid.

Is x-default valid?

Yes, when the line is exactly x-default. A single x-default line is 1 of 1 valid.

Why is english invalid?

A tag is 2 or 3 lowercase letters, optionally a hyphen and 2 to 8 letters or digits. english is longer than three letters and does not match that shape. x-default is the extra spelling that is allowed.

Is EN valid?

No. The language letters must be lowercase. EN is invalid. en is valid.

How many tags can I check?

From 1 to 20 after blank lines are dropped. More than 20, or a field that is empty, is rejected with Enter from 1 to 20 tags.

Does the page fetch a site?

No. It checks the lines you type. It does not request the pages those tags would point to.

Does a valid line mean the page built the link tag?

No. This page marks the shape valid or invalid. The hreflang generator is a different page that builds the link tags.