Hreflang Tag Generator
CodeURLActions
Row 1 needs a URL.
Hreflang tags tell search engines which version of a page to show for each language or region. Enter a code and URL for every page, add an optional x-default for everyone else, and this tool builds the block of link rel alternate tags for you to paste into the head of each page. Everything runs in your browser, so your URLs never leave your device.
How to use
- Enter a language or region code in the first field, for example en, fr, or en-US.
- Paste the full URL for that version of the page in the second field.
- Click Add row to include more languages or regions, one pair per row.
- Optionally set an x-default URL for users whose language is not listed.
- Click Copy and paste the generated tags into the head of every listed page.
Examples
- Codes en and fr with URLs https://example.com/ and https://example.com/fr/ produce two link tags: one with hreflang en and one with hreflang fr.
- Adding an x-default URL of https://example.com/ appends a third tag with hreflang x-default at the end of the block.
- Region targeting works too: en-US and en-GB pointing at https://example.com/us/ and https://example.com/uk/ create separate tags for each market.
FAQs
- What is the x-default tag for?
- The x-default tag points to a fallback page for users whose language or region does not match any of your listed versions. It is commonly used for a language selector or a global home page.
- Do I need to put these tags on every page?
- Yes. Each page in a set of alternates should list the full group, including a self referencing tag for its own language. Place the complete block in the head of every URL you listed.
- What format should the codes use?
- Use an ISO 639-1 language code on its own (en, de, fr) or a language plus an ISO 3166-1 region (en-US, pt-BR). Codes are not case sensitive in hreflang, but lowercase language with uppercase region is the common convention.
- Should the URLs be absolute?
- Yes. Always use full absolute URLs including the protocol, for example https://example.com/fr/. Relative URLs are not valid in hreflang attributes.
- Why does the tool reject a duplicate code?
- Each language or region code should appear only once in a set. A repeated code is ambiguous to search engines, so the tool flags it so you can fix the conflict before publishing.
Related tools
- Schema Markup GeneratorGenerate valid JSON-LD structured data for Article, FAQ, and Organization. Fill in the fields and copy a ready to paste script tag.
- JSON FormatterFormat, validate, and beautify JSON in your browser. Paste messy JSON, get clean indented output, then copy it back. Free, no signup.
- Query String ParserParse a URL query string into key and value pairs, or build one from pairs. Handles a leading question mark, repeated keys, and encoded values.
- Meta Tag GeneratorGenerate clean HTML meta tags: title, description, canonical, and robots. Get a ready to paste block with length warnings built in.
- Meta Tag and OG Preview GeneratorGenerate title, description, Open Graph, and Twitter tags, then preview how your page looks in Google, Facebook, X, and LinkedIn.
- Keyword Density CheckerPaste text and see the most frequent words plus their density percentage. Ignore stop words and pick how many top words to show.