ForHosting KIT · Web Scraping & Monitoring

Generate hreflang tags for multilingual pages

The hreflang tag generator turns a structured list of language or regional page versions into ready-to-paste HTML link elements.

● BetaFree · in your browser
Use it from WebAPIEmailTelegramApp soon

Runs in your browser. Free, unlimited — your data never leaves this page.

Add each locale code and its absolute page URL, optionally provide a general fallback for x-default, and receive both individual link records and one complete HTML block. The generator validates locale syntax, normalizes conventional casing, rejects duplicates, and safely escapes URLs for HTML attributes. It is useful for multilingual sites, international product catalogs, documentation portals, and any publishing workflow where alternate pages must be declared consistently.

Build a complete locale mapping

Start with one row for every equivalent page that belongs to the same multilingual or multiregional cluster. Each row needs a locale code and an absolute HTTP or HTTPS URL. A basic language code such as en or fr is appropriate when one page serves every visitor using that language. Add a region, such as en-GB or fr-CA, when content, pricing, availability, spelling, or legal terms differ by market. A four-letter script subtag can distinguish writing systems, as in zh-Hans or sr-Latn. The generator accepts language tags composed of a two- or three-letter language, an optional script, and an optional two-letter or three-digit region. It normalizes their usual casing so inconsistent input does not produce inconsistent markup. Include the current page as well as its alternates: hreflang clusters are intended to describe the complete set, not merely links away from one version. Keep every URL canonical, indexable, and specific to the language or market named by its code. The order of your rows is retained in the output, making generated blocks stable and easy to review in source control.

Choose and place x-default deliberately

Use the optional x-default field for a page that should serve visitors when none of the declared language or regional versions is the right match. Common choices include a language selector, an international landing page, or a market-neutral version that lets the visitor choose. Do not enter x-default as an ordinary locale row; the dedicated field prevents duplicate or ambiguous fallback declarations and always places the fallback after the locale-specific links. Leaving it empty is valid when the cluster has no meaningful default destination. The returned HTML contains one link element per mapping and, when supplied, one additional x-default element. Put the entire block in the head of every HTML page in the cluster, or send equivalent Link headers if your application manages alternates at the HTTP layer. Whichever delivery method you choose, keep the membership reciprocal: each page should identify itself and all of the same alternates. This tool generates the declaration accurately, but it cannot confirm that remote pages publish matching declarations, remain indexable, or resolve without redirects. Those checks belong in a separate crawl or hreflang audit.

Validate, publish, and maintain the output

Malformed locale codes are rejected rather than silently emitted. This catches frequent mistakes such as underscores, surrounding spaces, a missing language component, unsupported extra subtags, or using x-default inside the locale list. Duplicate codes are also rejected after normalization, so en-us and en-US cannot accidentally create competing entries. URLs must be absolute and use HTTP or HTTPS; relative paths, mail links, and script schemes are unsuitable because alternate declarations must identify crawlable pages. Once the input passes, copy the html field directly into your template or consume the links array when your framework renders head metadata itself. The array exposes the normalized hreflang value, original URL, and finished tag, which makes it convenient for CMS integrations and build pipelines. Regenerate the block whenever localized routes change, a market launches, or a fallback destination moves. Treat the mapping as maintained site configuration rather than a one-time snippet. In automated workflows, store the input alongside route definitions and compare generated output during deployment. API requests cost $0.002; browser execution is useful for one-off authoring, while the deterministic API is suited to repeatable publishing.

Launch a regional storefront

Generate consistent alternate tags for country-specific product pages and an international selector as x-default.

Publish localized documentation

Turn documentation route mappings into a stable HTML block that can be checked into each site build.

Automate CMS metadata

Use the structured links output to populate head metadata whenever editors add or move translated pages.

What locale code formats are accepted?

Use a two- or three-letter language code, optionally followed by a four-letter script and a two-letter or three-digit region, such as en, zh-Hans, or es-419.

Does the generator include x-default?

Yes. Provide the optional x_default URL and its tag is appended after the locale-specific tags.

Why are duplicate locales rejected?

Each cluster should have one destination for a given hreflang value. The generator compares codes after normalizing case to catch duplicates reliably.

Does this check reciprocal tags on my pages?

No. It creates markup from your mappings without network access. Use a separate hreflang checker or site crawl to audit deployed pages.

How much does an API request cost?

Each API request costs $0.002. The same deterministic generation can also run in the browser.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/web/hreflang-tags-generate

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/web/hreflang-tags-generate \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"locales":[{"locale":"en","url":"https://example.com/en/product"},{"locale":"fr-FR","url":"https://example.com/fr/produit"}]}'
{
  "locales": [
    {
      "locale": "en",
      "url": "https://example.com/en/product"
    },
    {
      "locale": "fr-FR",
      "url": "https://example.com/fr/produit"
    }
  ]
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "web.hreflang_tags_generate",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

timeout_sec30
max_crawl_pages25
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Read the full KIT documentation →