SEMrush Holdings Inc.

09/16/2025 | News release | Distributed by Public on 09/16/2025 04:55

What is hreflang and how does it work

Hreflang is an HTML attribute that tells search engines which language and regional version of a webpage to display to users based on their location and language preferences.

Hreflang works by including a code within a page's HTML that indicates the specific language and region targeting for that page. Search engines then use this information to serve the correct version to users, improving user experience.

Here's how you might see hreflang implemented on a webpage:

The above tags tell search engines that you have US, UK, and Spanish versions of your page, plus a default version for users who don't match any of the listed languages or regions.

Here are the key things you should know about hreflang:

  • Hreflang prevents duplicate content issues. When you have similar content in different languages or for different regions, hreflang signals to search engines that these are intentional variations rather than duplicate content. This prevents any unintended consequences, such as a drop in rankings.
  • It uses ISO language and country codes. The attribute format is hreflang="language-country" such as en-us for English speakers in the United States or fr-ca for French speakers in Canada.
  • Implementation requires reciprocal linking. Each language version must include hreflang tags pointing to all other versions, including itself.
  • You can implement hreflang in multiple ways. Add it to HTML head sections, XML sitemaps, or HTTP headers, with XML sitemaps often being the cleanest approach for large international sites.
  • Self-referencing hreflang tags are required. Each page must include an hreflang tag pointing to itself, such as a US page including hreflang="en-US" pointing to its own URL.
  • Include x-default for international users. Specify a fallback page for users whose language/location doesn't match any specific version.

Proper hreflang implementation ensures search engines serve the right content to the right users, improving both SEO performance and user satisfaction for international websites.

Use Semrush's Site Audit tool to double-check that your hreflang implementation is successful and that there are no errors that need to be addressed.

SEMrush Holdings Inc. published this content on September 16, 2025, and is solely responsible for the information contained herein. Distributed via Public Technologies (PUBT), unedited and unaltered, on September 16, 2025 at 10:56 UTC. If you believe the information included in the content is inaccurate or outdated and requires editing or removal, please contact us at [email protected]