Hreflang Generator
Use cases
Language code detection from URL path structure with configurable folder position.
Template string generation: <xhtml:link rel="alternate" hreflang="[lang]" href="[url]"/>.
Screaming Frog internal_html.csv compatible.
Max code length filter (default 5 chars).
Fallback default language setting.
Platform
Browser-based (no installation required)
Input
Screaming Frog internal_html.csv (or similar crawl)
URL path position for language (default: first folder)
Fallback language code
Output
CSV with URL, language code, generated XML tags. Or an XML sitemap (xmlns:xhtml namespace) where each URL carries only its own hreflang tag with no alternate grouping, so it is a starting point rather than a complete hreflang implementation.
Features
- Language detection from URL path position
- Configurable folder depth for language code
- Max code length filter (default 5 chars)
- Fallback default language setting
- Non-indexable filtering and URL pattern exclusion (default /page)
- CSV and XML sitemap outputs (one self-language tag per URL)
How to use
- 1 Upload crawl export with URLs
- 2 Set path position to detect language (/en/page = position 1)
- 3 Configure max code length and default language
- 4 Optionally filter non-indexable URLs and set exclusion patterns
- 5 Download CSV or XML sitemap, then group alternate URLs before deploying
Frequently asked questions
- Does the output link alternate language versions together?
- No. Each URL gets a single hreflang tag for its own detected language, and each url entry in the XML sitemap contains only that one tag. The tool does not match equivalent pages across languages, so for a valid hreflang implementation you still need to group the alternates and add every language's tag to each URL's entry.
- Why is a normal folder being treated as a language code?
- Detection is purely positional: whatever folder sits at the configured path position becomes the language code if it is no longer than the max code length, which defaults to 5 characters. Folders like blog or shop pass that test and are labelled as languages. Reduce the max length to 2 or 3, or add those folders to the exclusion patterns.
- What happens to URLs with no language folder?
- They are not skipped; they get the fallback default language, en unless you change it. Check the language distribution chart for an unexpectedly large default bucket.
- What does the default "/page" exclusion actually remove?
- Any URL containing /page anywhere, as a case insensitive substring. It is aimed at pagination but also catches paths like /pages/ or /page-builder, so adjust or clear the field if that is too broad for your site.
- How does the non-indexable filter work?
- It looks for a column with "indexability" in its name and drops rows containing "Non-Indexable". If your export has no such column, the filter is skipped silently even with the checkbox ticked, so non-indexable URLs would remain in the output.
Want me to run this for you?
I run this tool as a managed service, or build something custom around your data. You get the insights without touching the code.
Related Tools
Comprehensive OnCrawl API client for data extraction, crawl management, and analysis.
Extract Question/Answer pairs from JSON-LD schema markup.
Convert web pages to clean markdown using Firecrawl API.
Generate JSON-LD structured data for rich snippets without any API required.
Generate regex patterns from plain English descriptions for SEO tasks.
Generate correct hreflang tags for international SEO.
Need something built for your business?
This tool started as bespoke client work. I build custom scripts, data pipelines, and full apps for SEO and product data problems that off-the-shelf tools don't solve.
Tell Me What You Need