Hreflang Generator

Add each localized URL and get a complete hreflang set with x-default.

Language versions

Enter one complete URL for each localized version of the page.

Choose the fallback URL for visitors without a matching language or region.

0

Generated hreflang tags

The preview appears after all rows and x-default pass validation.

Ready. Load the example or add your language versions.0 language version(s)

Code and URL check

    Your URLs stay in your browser. Nothing is uploaded to BroBroGo.

    FAQ

    Which hreflang codes does this generator accept?

    Use a two-letter ISO 639-1 language code, optionally followed by an ISO 15924 script subtag and/or a two-letter ISO 3166-1 region code: en, zh-Hant, zh-CN or zh-Hans-US. Letter case is normalized in the output.

    Where should I place the generated tags?

    Add the complete, unchanged set inside the <head> of every localized version. Each page should reference itself and all the other versions.

    What should x-default point to?

    Choose the page for visitors whose language or region has no exact match. A language selector, global homepage or your main language version can be the fallback.

    Understanding the Hreflang Generator

    The Hreflang Generator is a specialized tool designed to help you create the correct rel=alternate hreflang tags for your website. When managing a website with multiple language or regional variations, search engines rely on these tags to serve the correct language or regional URL to users.

    By providing the URLs for each localized version of a page, along with an optional fallback URL for visitors whose language or region does not have an exact match, the tool generates a complete, validated set of hreflang tags that you can add directly to your web pages. This utility is built for website owners maintaining multilingual pages, SEO professionals, web developers, and anyone who needs to validate ISO codes or include an x-default fallback in their international SEO setup.


    Input Requirements and Supported Formats

    To generate accurate tags, the tool requires specific inputs for each localized version of your page:

    • Language or region: You must enter a two-letter ISO 639-1 language code. This can optionally be followed by an ISO 15924 script subtag, a two-letter ISO 3166-1 region code, or both (for example: en, zh-Hant, zh-CN, or zh-Hans-US).
    • Version URL: A complete URL starting with http:// or https://.
    • x-default URL: An optional, complete fallback URL starting with http:// or https://.

    The editor supports up to 100 language versions at a time. To ensure compatibility and prevent errors, all entered URLs must be shorter than 2,048 characters.


    Validation Rules and Code Normalization

    The generator features a built-in validation engine to ensure your tags comply with search engine standards. It validates ISO 639-1 language codes, ISO 3166-1 Alpha-2 region codes, and supported ISO 15924 scripts.

    During processing, the tool applies the following rules and normalization behaviors:

    • Case Normalization: Letter case is automatically normalized in the final output (for example, an input of EN-us is converted to en-US).
    • Script Normalization: Specific Chinese script codes like zh-Hant and zh-Hans are normalized.
    • Query Parameters: URL query parameters are properly escaped in the generated output.
    • Unsupported Codes: Regional codes such as es-419 (Latin America) and any other unknown codes are rejected.
    • Error Handling: Tags are only generated if all inputs are valid. If any errors are present, the output remains empty.

    Troubleshooting Validation Errors

    If your inputs do not meet the validation criteria, the tool will display specific error messages to help you identify and resolve the issues:

    • "Add at least two language versions.": Appears when you have not provided the minimum required versions to establish an alternate relationship.
    • "Version {index} needs a language or language-region code.": Triggered when the language field for a specific version is left blank.
    • "Version {index} needs a complete URL.": Triggered when a version is missing its corresponding web address.
    • "Version {index} must use a two-letter language code, optionally an ISO 15924 script and/or a two-letter region code.": Shown when the format of the entered locale does not match the expected structure.
    • "Version {index} uses {code}, which is not an ISO 639-1 language code.": Indicates that the entered language code is invalid or unrecognized.
    • "Version {index} uses {code}, which is not an ISO 3166-1 Alpha-2 region code.": Indicates that the regional subtag is invalid.
    • "Version {index} uses {code}, which is not a valid ISO 15924 script code.": Indicates that the script subtag is unrecognized.
    • "Version {index} repeats the hreflang code {locale}.": Occurs when the same language or regional code is assigned to multiple URLs.
    • "Version {index} needs a complete http:// or https:// URL.": Shown if the URL is missing its protocol.
    • "The URL for version {index} must be shorter than 2,048 characters.": Triggered if a URL exceeds the maximum character limit.
    • "Add the URL that x-default should use.": Appears if the x-default field is enabled but left empty.
    • "The x-default URL needs a complete http:// or https:// address.": Shown if the fallback URL is missing its protocol.
    • "The x-default URL must be shorter than 2,048 characters.": Triggered if the fallback URL exceeds the character limit.
    • "This editor supports up to {max} language versions at a time.": Appears if you attempt to add more than 100 language versions.

    Privacy and Data Processing

    When using this tool, your privacy is fully maintained. Your URLs stay in your browser, and nothing is uploaded to BroBroGo. All validation and tag generation are performed locally on your device.


    Frequently Asked Questions

    Which hreflang codes does this generator accept?

    Use a two-letter ISO 639-1 language code, optionally followed by an ISO 15924 script subtag and/or a two-letter ISO 3166-1 region code: en, zh-Hant, zh-CN or zh-Hans-US. Letter case is normalized in the output.

    Where should I place the generated tags?

    Add the complete, unchanged set inside the <head> of every localized version. Each page should reference itself and all the other versions.

    What should x-default point to?

    Choose the page for visitors whose language or region has no exact match. A language selector, global homepage or your main language version can be the fallback.