International SEO
The web is not in one language. Someone in Paris searches in French. Someone in Pune searches in Hindi or English. Someone in Lagos, Lima, or Lahore searches in their own words too, in their own way, with their own spellings, prices, and habits.
If your site speaks to more than one of them, international SEO is how you tell search engines (and browsers, and screen readers) which version is for whom. Done well, a reader sees your page in the right language. Done badly, a French reader lands on your English page, and a Hindi reader never finds your Hindi one at all.
This is the last lesson in the SEO section, and it ties together almost everything before it: titles, descriptions, canonical links, and Open Graph tags, all repeated, for every language.
What You Will Learn
- The difference between a language and a region
- The
langattribute, and what it is for - How to use
hreflanglinks, includingx-defaultand return links - The right codes (and the common wrong ones)
- How to choose a URL structure
- How canonical, titles, and Open Graph fit with each version
- Localisation beyond translation
- How to check your setup
The Big Idea
- HTML Code
- hreflang Builder
<!doctype html>
<html lang="en">
<head>
<title>Rye Bread Recipe | The Bread Bin</title>
<link rel="canonical" href="https://thebreadbin.example/recipes/rye-bread">
<link rel="alternate" hreflang="en" href="https://thebreadbin.example/recipes/rye-bread">
<link rel="alternate" hreflang="en-GB" href="https://thebreadbin.example/uk/recipes/rye-bread">
<link rel="alternate" hreflang="fr" href="https://thebreadbin.example/fr/recettes/pain-de-seigle">
<link rel="alternate" hreflang="hi" href="https://thebreadbin.example/hi/rye-bread">
<link rel="alternate" hreflang="x-default" href="https://thebreadbin.example/recipes/rye-bread">
</head>
One row for each version of the page, including the page you are on.
Put this same block in the head of every version:
<link rel="alternate" hreflang="en" href="https://thebreadbin.example/recipes/rye-bread">
<link rel="alternate" hreflang="en-GB" href="https://thebreadbin.example/uk/recipes/rye-bread">
<link rel="alternate" hreflang="fr" href="https://thebreadbin.example/fr/recettes/pain-de-seigle">
<link rel="alternate" hreflang="hi" href="https://thebreadbin.example/hi/rye-bread">
<link rel="alternate" hreflang="x-default" href="https://thebreadbin.example/recipes/rye-bread">
Or put it in your sitemap, for this page:
<url>
<loc>https://thebreadbin.example/recipes/rye-bread</loc>
<xhtml:link rel="alternate" hreflang="en" href="https://thebreadbin.example/recipes/rye-bread"/>
<xhtml:link rel="alternate" hreflang="en-GB" href="https://thebreadbin.example/uk/recipes/rye-bread"/>
<xhtml:link rel="alternate" hreflang="fr" href="https://thebreadbin.example/fr/recettes/pain-de-seigle"/>
<xhtml:link rel="alternate" hreflang="hi" href="https://thebreadbin.example/hi/rye-bread"/>
</url>
0 things to check.
No problems found by these simple checks.
Try changing a code to en-UK, jp, or fr_FR, and see the advice. The sitemap form also needs the xhtml namespace on the urlset element, and one block per page. Use one method (tags, headers, or sitemap), and keep it consistent. Search engines treat hreflang as a hint.
Edit the codes and addresses. Try the common mistakes, and watch the advice change.
Language, Region, and Script
A language is what people speak and read. A region is where they live. They are not the same, and sometimes both matter.
| Code | Meaning | Why you might separate them |
|---|---|---|
en | English, any region | One English version for everybody |
en-GB | English for the United Kingdom | Spelling (colour), currency (pounds), units |
en-US | English for the United States | Spelling (color), currency (dollars) |
pt-BR | Portuguese for Brazil | Different words and grammar from Portugal |
zh-Hans and zh-Hant | Chinese, simplified and traditional script | Different writing systems |
fr | French, any region | One French version for everybody |
You do not need a region for every language. Add one only when the content really differs, such as prices, laws, spelling, or shipping.
The codes
- Language: two or three lowercase letters, from the ISO 639 list (
en,fr,hi,ja). - Region: two uppercase letters, from the ISO 3166-1 list (
GB,US,IN,BR). - Script (rare): four letters with a capital first, such as
HansorHant. - Separator: a hyphen, never an underscore:
en-GB, noten_GB. - Region alone is not allowed.
GBis not a code. You need the language:en-GB.
Common wrong codes: en-UK (it should be en-GB), jp (it should be ja), cz (should be cs), gr (should be el), ua (should be uk), and fr_FR with an underscore.
The lang Attribute
<html lang="fr">
The lang attribute on the html element says what language the page is written in. It matters for:
- Screen readers, which choose the right voice and pronunciation.
- Browsers, for hyphenation, spell-check, quotation marks, and font choices.
- Translation tools, which can offer or skip translation.
- Styling, with the
:lang()CSS selector.
Search engines mostly work out a page's language from its text, and do not rely on lang for it. So lang is not a ranking tool, but you should always set it, for people. For a passage in another language, put lang on that element:
<p>The French call it <span lang="fr">pain de seigle</span>.</p>
For right-to-left languages, add dir="rtl" as well: <html lang="ar" dir="rtl">.
hreflang: Pointing to Your Other Versions
hreflang tells search engines: "This page has the same content in these other languages and regions, here are the addresses." They can then show each reader the version that matches them best.
<link rel="alternate" hreflang="fr" href="https://thebreadbin.example/fr/recettes/pain-de-seigle">
The rules
- Include every version, including the page itself. The block is the same on every version.
- Return links are required. If the English page points to the French page, the French page must point back to the English page. Search engines usually ignore one-way links.
- Use full addresses, with
https://. - Use correct codes.
- Add one
x-default, pointing to the version for readers who match none of the others (often the English page, or a language chooser). - Use it for real alternatives only: pages with the same content in a different language or region. Do not link unrelated pages.
- Keep it consistent with your canonical links and sitemap.
Check the return links yourself:
Each row is a page. Tick the versions that page lists in its hreflang links, including itself.
| This page links to... | English page | French page | Hindi page |
|---|---|---|---|
| English page | |||
| French page | |||
| Hindi page |
1 problem found.
- The English page points to the Hindi page, but the Hindi page does not point back. Search engines may ignore this pair.
The rule: if page A says "B is my Hindi version," then B must say "A is my English version." These are called return links, and search engines usually need both sides before they trust the pair.
Three ways to add it
| Method | Where | Good for |
|---|---|---|
| Link tags | In the head of each page | Small and medium sites |
| HTTP headers | Sent by the server | PDFs and non-HTML files |
| Sitemap | In your XML sitemap | Large sites, where editing every head is hard |
Pick one method, and keep it correct. Mixing methods that disagree causes confusion. The Link element lesson has more on the tag itself.
Like canonical, hreflang is a hint, not a command. Search engines may still show a different version. The better your content, signals, and consistency, the more likely they are to follow it.
Canonical and hreflang Together
Each language version should have a canonical that points to itself, not to the English page:
<!-- On the French page -->
<link rel="canonical" href="https://thebreadbin.example/fr/recettes/pain-de-seigle">
If you point every translation's canonical to the English page, you are telling search engines to ignore the translations. See Canonical Links.
Pages in the same language for different regions (such as en-US and en-GB) can look nearly identical. That is fine, as long as the details (currency, spelling, shipping) really differ, and the hreflang links are correct.
Choosing a URL Structure
| Structure | Example | Good | Think about |
|---|---|---|---|
| Country domain (ccTLD) | thebreadbin.fr | A very strong signal for a country | Costly, and every site is separate |
| Subdomain | fr.thebreadbin.example | Can be hosted separately | Treated as a separate site by some tools |
| Subfolder | thebreadbin.example/fr/ | One site, simple to manage | Same hosting for all |
| URL parameter | thebreadbin.example/?lang=fr | Easy to build | Not recommended. Hard to read and crawl |
For most sites, subfolders are the simplest and most practical choice. Whatever you choose, be consistent, and keep each language on its own stable addresses.
Translation and Localisation
Translation changes the words. Localisation changes everything that people in a place expect.
- Translate the whole page, including the title, description, headings, image alt text, buttons, and error messages. Do not mix languages on a page.
- Use a good translation. Raw machine translation can be awkward or wrong. Have a native speaker review the pages that matter.
- Research local words. People in different places search for the same thing with different terms. Translate the meaning, and check what locals actually type.
- Show local formats: dates, times, numbers, currency, units, phone numbers, and addresses.
- Check images and colours. Pictures, gestures, and symbols can mean different things in different places. Text inside images needs a version per language.
- Support the language's needs: right-to-left layout for Arabic, Hebrew, Persian, and Urdu; fonts that include the right characters (Indic scripts, CJK); and room for longer or shorter text.
- Use UTF-8 everywhere, so every character displays.
- Offer local ways to pay and contact, where relevant.
- Follow local rules about privacy, advertising, and consumer rights. This is not legal advice.
Make Each Version Complete
Every version needs its own:
langattribute.- Title and meta description, written in that language. See Title (SEO) and Meta Description.
- Headings and content, not a copy of the English.
- Open Graph and Twitter tags, with
og:localeset, andog:locale:alternatefor the others. See Open Graph. - Structured data, with
inLanguage, if used. - Canonical link pointing to itself.
- Sitemap entry.
A translated page that keeps its English title and description is only half translated.
Language Switchers and Redirects
- Use real links in your language switcher, so crawlers and people can follow them. See HTML SEO Basics.
- Label each language in its own language: "Français," "हिन्दी," "العربية," not "French," "Hindi," "Arabic."
- Do not force a redirect based on a visitor's location or language. Search engine crawlers usually visit from one place, so they may never see your other versions. And people travel, use a VPN, or speak a different language from the country they are in. Instead, suggest the right version with a banner, and let the person choose. Then remember their choice.
- Do not hide content behind a language cookie. Every version should have its own address.
Local Search Engines and Signals
- Google and Bing are widely used, but Baidu (China), Yandex (Russia and nearby), Naver (Korea), and others matter in their regions. Each has its own guidelines and tools, and some do not use
hreflangin the same way. Check the ones your readers use. - Country targeting. Search Console has had country-targeting settings for some site types. Check what is currently available.
- Local signals such as a local domain, local hosting speed, local addresses and phone numbers, and local links all help a page seem relevant to that place.
- Speed matters. A content delivery network (CDN) can serve your pages quickly from near your readers.
Check Your Setup
Check it for real
- "View source" on each version, and search for
hreflang. - Make a table: every version, its address, its code, and the list of alternates it names. Check that the lists match.
- Search Console has reports and tools for international targeting. Check the current names.
- A crawler tool can check return links across a whole site.
- Search in each language, from each country if you can, and see which version appears.
- Ask native speakers to read each version.
Good Habits
- Set
langon every page, anddirfor right-to-left languages. - Give every version its own address, stable and linked.
- Use correct
hreflangcodes, include the page itself, and addx-default. - Check return links.
- Point each version's canonical to itself.
- Translate everything, including titles, descriptions, and alt text.
- Localise formats, currency, images, and examples.
- Suggest, do not force, a language.
- Test with native speakers and real devices.
International SEO Checklist
- Every page has the right
lang(anddirwhere needed) - Each language or region has its own stable address
-
hreflanglinks list every version, including the page itself - Return links exist in both directions
- Codes are valid, hyphenated, and correctly capitalised
- There is an
x-default - Each version's canonical points to itself
- Titles, descriptions, headings, alt text, and tags are translated
- Open Graph tags have
og:locale, with alternates - A language switcher with real links, labelled in each language
- No forced redirects by location or browser language
- Dates, currency, units, and formats are localised
- A native speaker reviewed the key pages
Security and Privacy Notes
- Do not use
hreflangwith untrusted addresses. If an address in a link tag comes from user input or a database, an attacker could inject a link to a bad site, or break your HTML. Build the tags from fixed, validated data, and escape the output. The builder above does this. - Be careful with automatic language detection. Guessing a person's language or country from their address, or their browser, reveals something about them. Use it only to make a suggestion, collect no more than you need, and do not store it without a reason.
- Language cookies and preferences can be personal data in some places. Tell people what you store, and give them a way to change it. This is not legal advice.
- Different regions have different rules. Privacy laws (such as the GDPR in Europe), advertising rules, and consumer rights vary. A page for one country may have to say something different from another.
- Do not block or cloak content by country in a way that shows crawlers something different from visitors. It can look like a trick, and may be penalised.
- Check that private or draft translations are protected. Unfinished language versions on a public address can be found and indexed.
- Beware of machine-translated spam. Auto-translated pages created in bulk, with no review, can be treated as low-quality, and a hacked site is sometimes filled with them. Check your site for languages you do not offer.
Global Audience Notes
- This whole lesson is about reaching a world audience, so remember the person behind every code. Behind
hiis someone who may read your page on a small phone, on a slow connection, and in a script your design never tested. - Use real language names in your switcher, and let people change language from any page.
- Do not assume one language per country. India, Switzerland, Canada, Belgium, and many others have several. A person's language is their choice, not their address.
- Plan for text growth. German and Finnish words run long, and some languages run short. Test your layout with real translations.
- Names, forms, and addresses differ widely. Do not require a "first name" and "last name," or a ZIP code, for everyone.
- Fonts and encodings: use UTF-8, and a font family with fallbacks for each script you support.
- Right-to-left pages need mirrored layouts, and care with numbers, icons, and mixed-direction text.
- Time and calendars: show time zones, and consider local calendars where they matter.
- Accessibility needs translation too. Alt text, labels, error messages, and captions in each language.
- Test on real devices in real places, or with people who live there.
Common Mistakes to Avoid
- No
langattribute, or the wrong one (English on a French page). - Wrong codes:
en-UK,jp,fr_FR, or a region alone. - Missing return links.
- No self-reference in the hreflang list.
- Canonical pointing every translation to the English page.
- Translating the body but not the title, description, or alt text.
- Forcing redirects by location or browser language.
- Language chosen by a cookie or parameter, with no address of its own.
- Relative addresses in hreflang.
- Mixing hreflang methods that disagree.
- Raw machine translation with no review.
- Never checking the versions with native speakers.
Practice Time
Try these in your browser and your editor:
- Use the hreflang builder with four versions. Then try
en-UK,jp,fr_FR, andGBalone. What does it say about each? - Switch the x-default to a different version. What changes in the tags?
- Use the return-link matrix. Fix the problem by hand, then try "Link every page to every page."
- Run the checker on the messy page, fix every problem, and run it again.
- Add
langto a page, and alangon a phrase in another language. Listen to it with a screen reader if you can. - Choose a URL structure for a site you imagine, and write down why.
- Translate a page title and description into a language you know, and check the length.
- Look at three multilingual sites. How do their language switchers work?
- Search for the same thing in two languages. Which version of a site appears for each?
- Bonus: build a three-language version of a one-page site, with correct
lang,hreflang, canonical, and Open Graph tags for each.
Quick Recap
Click a question to check your answer.
1. What is the lang attribute for?
It says which language the page is written in, so screen readers, browsers, and translation tools can behave correctly. It is for people and tools. Search engines mostly work the language out from your text.
2. What does hreflang do?
It tells search engines which other language or region versions of a page exist, and where, so each reader can be shown the best match.
3. What is a return link, and why does it matter?
If page A lists page B as an alternate, page B must list page A back. Search engines usually ignore one-way links.
4. What is x-default?
A fallback version for readers who match none of your listed languages or regions. It is often the main language page, or a language chooser.
5. Where should a translated page's canonical point?
To itself. Pointing every translation to the English page tells search engines to ignore the translations.
6. Why not redirect people automatically by their location?
Crawlers may never see the other versions, and people travel, use a VPN, or speak a different language from their location. Suggest a version, and let the person choose.
Key Takeaways
- Set
langon every page, for people and tools. - Use
hreflangto link every version, including the page itself, with return links and anx-default. - Use correct codes: language in lowercase, region in capitals, joined with a hyphen.
- Each version has its own address and its own self-pointing canonical.
- Translate everything, including titles, descriptions, alt text, and tags, and localise formats.
- Suggest, do not force, a language.
- Subfolders are the simplest URL structure for most sites.
- Test with native speakers, and remember the person behind every code.
You have finished the SEO section. Go back to the section overview, pick any lesson to revisit, and then check one of your own pages from title to hreflang.