SEO Tools

Hreflang Tag Generator

Live

Generate reciprocal hreflang link elements from locale and URL rows.

About Hreflang Tag Generator

Generate reciprocal hreflang link elements from locale and URL rows. Enter language tag | url, x-default url in a purpose-built hreflang map interface designed for this subject. Validated BCP 47-style language tags and absolute URLs are serialized as alternate link elements, including optional x-default. The result includes hreflang tags, locale entries, diagnostics, supporting detail, and clear units or diagnostics. Results depend on the entered assumptions, units, and rounding. Review important decisions against authoritative requirements. Processing stays in your browser, and UtilityPages does not store the values you enter.

Set up Hreflang Tag Generator

Workspace

Source workbench

Edit the source fields below and inspect the rendered output alongside your work.

Complete the fields to prepare a result.

Enter language tag | url.

Enter x-default url.

Hreflang Tag Generator result

Enter the values above, then calculate to see a detailed result.

How Hreflang Tag Generator works

Validated BCP 47-style language tags and absolute URLs are serialized as alternate link elements, including optional x-default.

How it works

Validated BCP 47-style language tags and absolute URLs are serialized as alternate link elements, including optional x-default. Results depend on the entered assumptions, units, and rounding. Review important decisions against authoritative requirements.

Examples

Hreflang Tag Generator worked example

Example input
{
    "pages": "en-US|https://example.com/us/page\nen-GB|https://example.com/uk/page\nfr-FR|https://example.com/fr/page",
    "default_url": "https://example.com/page"
}
Expected result
{
    "tags": "<link rel=\"alternate\" hreflang=\"en-US\" href=\"https://example.com/us/page\">\n<link rel=\"alternate\" hreflang=\"en-GB\" href=\"https://example.com/uk/page\">\n<link rel=\"alternate\" hreflang=\"fr-FR\" href=\"https://example.com/fr/page\">\n<link rel=\"alternate\" hreflang=\"x-default\" href=\"https://example.com/page\">",
    "entries": [
        {
            "language": "en-US",
            "url": "https://example.com/us/page"
        },
        {
            "language": "en-GB",
            "url": "https://example.com/uk/page"
        },
        {
            "language": "fr-FR",
            "url": "https://example.com/fr/page"
        }
    ],
    "diagnostics": []
}

Privacy

This tool does not store your inputs or results on UtilityPages.org.

Citations & sources

  1. Tell Google about localized versions

Frequently asked questions

How does the Hreflang Tag Generator work?

Validated BCP 47-style language tags and absolute URLs are serialized as alternate link elements, including optional x-default.

What information should I enter?

Enter language tag | url, x-default url. Use values and units from the same scenario so the result is internally consistent.

What results does this tool provide?

It reports hreflang tags, locale entries, diagnostics, including intermediate context where it helps you review the answer.

What limitations should I know about?

Results depend on the entered assumptions, units, and rounding. Review important decisions against authoritative requirements.