In short: For US local businesses the most common case is an English site with a Spanish version. Enter each URL, pick the language and region, and copy either HTML link tags or XML for your sitemap.
Both outputs follow Google's rules, including the self-referencing entry and the optional x-default.
How to use the hreflang tag generator
Add one row for each version of the page. Enter the full URL, pick the language and, if needed, the region. Add an optional x-default URL, choose HTML or XML output and copy the result. Paste the same set of tags on every version listed.
Each row needs an absolute URL, including https://. The generator warns you if one is missing or if two rows share the same code.
Use the HTML option for a few pages and the XML option when you have many. The XML goes into your sitemap file.
Hreflang tags vs sitemap hreflang
You can declare hreflang in three places: link tags in the head of each page, HTTP headers, or your XML sitemap. All three mean the same thing to Google. Choose one method and keep it consistent. Link tags suit small sites, and sitemap entries are easier to maintain on larger ones.
Never mix methods for the same URLs, because conflicting declarations are harder to debug. The generator's HTML tab gives you head tags, and its XML tab gives you a ready sitemap with the xhtml namespace included.
The rules Google expects you to follow
Every version must list all versions, including itself. If page A points to page B, page B must point back to A. Use ISO language codes with optional ISO region codes, such as en-US or es-US. A region code cannot stand alone, and every URL must be fully qualified.
Missing return links are the most common error, and Google ignores the annotations when they are not confirmed from both pages.
- Language: two letters, such as en or es
- Region: optional, two letters, such as US or MX
- Add the self-referencing tag on every page
- Use the same canonical URL in hreflang and in the canonical tag
When a US local business needs hreflang
You need hreflang when you publish the same page in more than one language or for more than one region: an English page and a Spanish page for the same service, or separate pages for the US and Canada. A single-language site with city pages does not need it.
A dentist in San Antonio with an English and a Spanish page for implants is a typical case. A plumber with one English page per city is not.
Translated pages should read as written for that audience. Machine copies with the same text barely help the visitor.
What x-default does
The x-default tag names the page Google should show when no version matches the searcher's language or region. Point it to a language picker or to your main version. It is optional, but it prevents visitors from landing on a page they cannot read.
Most small sites point x-default to the English page. Larger sites point it to a page where visitors choose their language.
Common hreflang mistakes
The most frequent errors are missing return tags, invalid language or region codes, relative URLs and tags that point to pages that redirect or return an error.
Every page in a hreflang set must link back to every other page in the set. If page A points to page B but B does not point back, Google may ignore the pair.
Use full absolute URLs, and make sure each URL in the set loads with a 200 status. The HTTP status code checker on this site can confirm that.
- Include a self-referencing tag on every page
- Use valid ISO codes, such as en-US and es-US
- Never point hreflang at a redirected or blocked page
Language only or language plus region
Use a language code alone, such as es, when the page suits all speakers of that language. Add a region, such as es-US, only when the content really differs for that country.
A business with one English page and one Spanish page for the same US market only needs en and es, or en-US and es-US if you want to be explicit.
The language comes first and the region second. Writing en-UK is a common mistake: the correct code for the United Kingdom is en-GB.
A bilingual local business example
A restaurant in San Antonio with an English menu page and a Spanish menu page would add two tags to each page, one for each version, plus an x-default pointing to the main page.
Each version declares itself and the other. Visitors who search in Spanish are more likely to land on the Spanish page, and English searchers on the English one.
Keep the content equivalent. Translating a page loosely or changing the offer defeats the purpose of linking them.
Test your hreflang setup
After you publish, view the page source and confirm the tags are in the head, then request the pages in Google Search Console and watch for errors or warnings.
Open each language version in a private window and check that the links between them work.
If you manage many pages, check a few sample pages from each section. Fix the pattern once, not page by page.
Keep going with local SEO
Planning a Spanish version of your pages?
We build local pages that rank and read naturally. Start with an audit of what you have. Book a free 30-minute audit.
Sources: Google Search Central: Localized versions of your pages (hreflang).