This guide explains how to use Hreflang Tag Generator, step by step, with screenshots of the real tool. It is written for site owners, developers and SEOs who look after crawling, indexing and site health. Generate correct hreflang tags for multilingual and multi-region websites, including the x-default tag, in HTML or sitemap format.
Quick answer: To use the Hreflang Tag Generator, open the free tool, paste the language versions, enter the x-default URL and choose the output format, then copy the text it creates. Everything runs in your browser, so there is no sign up and nothing you type is stored on a server.
On this page

What is the Hreflang Tag Generator?
Create hreflang link tags or XML sitemap entries for multilingual and multi-country sites with x-default.
Hreflang tells Google which language or country version of a page to show each searcher. It stops your UK page from ranking in the US and the other way round.
How to use Hreflang Tag Generator step by step
-
Step 1: Open the Hreflang Tag Generator
Go to the Hreflang Tag Generator on hasnainsanmal.com. It loads with example values already filled in, so you can see how it works straight away. It works the same way on a phone, tablet or computer.
-
Step 2: Paste Language versions
Paste or type your text into Language versions (language code | URL, one per line). The example starts with: en-us | https://example.com/ en-gb | https://example.com/uk/ ur-pk….
-
Step 3: Enter x-default URL
In the x-default URL box, type your own value. The example uses https://example.com/, which you can replace.
-
Step 4: Choose Output format
Choose an option from Output format. Options include HTML link tags and XML sitemap. The example uses HTML link tags.
-
Step 5: Read the results
The output appears inside the tool card. Change any input to compare different scenarios.

Screenshot of the Hreflang Tag Generator results. -
Step 6: Copy or download the output
Use Copy to take the result into your document, CMS, spreadsheet or report.
What does each field in the Hreflang Tag Generator mean?
| Field | What to enter | Example |
|---|---|---|
| Language versions | Text, one item per line where asked | en-us | https://example.com/ en-gb | https://example.com/uk/ ur-pk… |
| x-default URL | Your text | https://example.com/ |
| Output format | Choose one option (HTML link tags, XML sitemap) | HTML link tags |
What does a worked example look like?
With the example inputs (x-default URL: https://example.com/ and Output format: HTML link tags), the Hreflang Tag Generator returns: <link rel="alternate" hreflang="en-us" href="https://example.com/" /> <link rel="alternate" hreflang="en-gb" href="https://example.com/uk/" /> <link rel="alternate" hreflang="ur-pk" href="https://example.com/ur/" />…
Replace the example with your own input to get your own result, then review it before you use it.
How do you get the best results from the Hreflang Tag Generator?
- Every version must list all other versions, including itself.
- Use ISO 639-1 language codes and optional ISO 3166-1 country codes, like en-gb.
- Add an x-default for users who match no version.
- Re-check after every theme, plugin or server change.
- Confirm fixes in Google Search Console with URL Inspection.
For background, read the Google crawling and indexing documentation. If you are working on a related task, our guide on how to use the .htaccess Redirect Generator walks through it the same way. You can also browse all free Technical SEO Tools.
What mistakes should you avoid with the Hreflang Tag Generator?
- Testing on a staging copy and forgetting that the live site has different rules.
- Fixing one URL and not checking the template that created the problem.
- Changing URLs without adding 301 redirects.
Key terms
- Indexing
- The process in which Google stores a crawled page in its index so it can appear in search results. A page must be crawlable, return a 200 status code and not carry a noindex tag before it can be indexed.
- XML sitemap
- A file that lists the URLs you want search engines to find, often with last modified dates. Submitting it in Google Search Console helps new and deep pages get discovered faster, although it does not guarantee indexing.
- Google Business Profile
- The free Google listing that shows a local business in Maps and the local pack, with its address, hours, photos and reviews. A complete, accurate profile and genuine reviews are key local ranking factors.
- HTML
- HyperText Markup Language, the standard language that structures web pages with elements such as headings, paragraphs, links and images. Search engines read the HTML to understand page content, links and metadata.
- Character count
- The number of letters, numbers, spaces and symbols in a piece of text. Many platforms set limits by characters, such as title tags, meta descriptions and social posts, so counting before publishing avoids truncation.
Related free tools
Frequently asked questions
Is the Hreflang Tag Generator free to use?
Yes. The Hreflang Tag Generator is completely free, with no sign up, no daily limit and no watermark. It is one of more than 500 free SEO and marketing tools on hasnainsanmal.com.
Is my data stored when I use the Hreflang Tag Generator?
No. The Hreflang Tag Generator runs in your browser with JavaScript, so the values and text you enter are processed on your own device and are not sent to or saved on our server.
How accurate is the Hreflang Tag Generator?
It creates a solid first draft from your inputs. Always review and edit the output so it is accurate, specific and sounds like you before you publish or send it.
Does the Hreflang Tag Generator work on a phone?
Yes. The tool is built for screens from 360 pixels wide, so you can use the Hreflang Tag Generator on a phone, tablet or computer in any modern browser.
Can I use the Hreflang Tag Generator for client work?
Yes. You can use the results for your own sites and for client projects. Check the output first, and keep a note of the inputs you used so you can repeat the check later.
What should I do after using the Hreflang Tag Generator?
Apply the result on your page, campaign or document, then measure the effect. If you would like expert help, see the SEO services or message Hasnain on WhatsApp for a free recommendation.
How we checked this guide: every step and screenshot was taken from the live Hreflang Tag Generator on 2 November 2026. Further reading: Google SEO Starter Guide.




