How to Do Hreflang Tags for a Multilingual Website (Complete 2026 Guide)

If you run a multilingual website, simply translating your content is not enough. Search engines need clear signals to understand which version of your page should be shown to which user. This is where hreflang tags become essential.
When implemented correctly, hreflang tags ensure your audience lands on the right language version of your site—improving both user experience and SEO performance.
What Are Hreflang Tags?
Hreflang tags are snippets of code that tell search engines which language and regional version of a page should be displayed to users based on their location and language preferences.
For example, if you have:
- an English version for the US
- an English version for the UK
- a Spanish version
hreflang tags help search engines deliver the correct version to the right audience.
Why Hreflang Is Important for SEO
Without hreflang tags, search engines may:
- Show the wrong language version to users
- Treat translated pages as duplicate content
- Rank the incorrect regional page
With proper implementation, you can:
- Improve international rankings
- Reduce bounce rates
- Increase engagement and conversions
When Should You Use Hreflang?
You need hreflang tags if:
- Your website is available in multiple languages
- You target different countries with similar content
- You have region-specific variations (e.g., pricing, currency, spelling)
Hreflang Tag Syntax
<link rel="alternate" hreflang="en" href="https://example.com/en/" />
<link rel="alternate" hreflang="en-GB" href="https://example.com/uk/" />
<link rel="alternate" hreflang="es" href="https://example.com/es/" />
<link rel="alternate" hreflang="x-default" href="https://example.com/" />
Language and Region Codes
- Language codes:
en,fr,de,es - Region codes:
US,GB,CA
Correct format:
-
en(language) -
en-US(language + region)
Where to Implement Hreflang Tags
- HTML
<head>section (most common) - XML sitemap (recommended for large sites)
- HTTP headers (for non-HTML files)
Best Practices
- Use self-referencing hreflang tags
- Ensure reciprocal linking between pages
- Use absolute URLs (https://)
- Add
x-defaultfallback - Keep content equivalent across languages
Important: Robots.txt Must Allow Crawling
For hreflang to work correctly, search engines must be able to crawl your pages. That means your robots.txt file must not block important content.
Here is an example of a properly configured robots.txt:
User-agent: *
Allow: /
Disallow: /admin/
# Allow AI agents
User-agent: GPTBot
Allow: /
User-agent: Google-Extended
Allow: /
User-agent: OAI-SearchBot
Allow: /
User-agent: Claude-Web
Allow: /
Sitemap: https://example.com/sitemap.xml
Why this matters:
- If pages are blocked, hreflang tags will be ignored
- Search engines must access all language versions
- AI crawlers are increasingly important for visibility in AI-driven search
What Is Sitemap in Robots.txt?
The Sitemap:
line tells search engines where to find your XML sitemap.
Example:
Sitemap: https://example.com/sitemap.xml
A sitemap helps search engines:
- Discover all versions of your pages
- Understand site structure
- Index multilingual content faster
What Is /llms.txt and Why You Should Create It
In 2026, a new best practice is to create a file called:
/llms.txt
This is a simple text file placed in the root directory of your website (e.g., https://example.com/llms.txt
).
Purpose of llms.txt:
It provides guidance for AI systems (like ChatGPT, Claude, and others) on how they can use your content.
Example llms.txt:
# llms.txt
User-agent: *
Allow: /
# Content usage policy
Content-Usage: Allowed for training and summarization
Attribution: Required
Why it matters:
- Helps AI tools understand your content permissions
- Increases chances of being referenced in AI-generated answers
- Future-proofs your SEO strategy
Common Mistakes to Avoid
- Blocking pages in robots.txt
- Missing return links between hreflang pages
- Incorrect language codes
- Using relative URLs
- Ignoring sitemap or llms.txt
Final Thoughts
Hreflang tags are a critical part of international SEO—but they don’t work in isolation. Your site must be crawlable, structured, and accessible to both search engines and AI systems.
By combining:
- correct hreflang implementation
- properly configured robots.txt
- a submitted sitemap
- and a modern llms.txt file
you create a strong foundation for global visibility in both traditional search and AI-driven discovery.
This is what modern SEO looks like in 2026.









