Hreflang Format Converter (HTML, HTTP Header, Sitemap)

Reads hreflang in any of the three formats Google supports and writes it in another: link tags, an HTTP Link header, sitemap XML, or Apache and nginx configuration lines.

Use the tool

Why this tool exists

You choose one place for hreflang: the page head, the HTTP header (the only option for PDFs and other non-HTML files) or the sitemap. Moving between them by hand is tedious. Paste what you have, pick the output and copy it.

The converter checks the codes and that URLs are absolute. For headers it lists every version including the requested one, as Google requires. The Apache and nginx output sets the same Link header for each file; adjust paths to your layout.

How to use it

  1. Paste link tags, a Link header, sitemap XML or code | URL lines.
  2. Choose the output format.
  3. Read any code or URL errors.
  4. Copy the result into your page, sitemap or server config.

Frequently asked questions

Which format should I pick?

Google treats the three as equivalent. Use headers for PDFs, a sitemap for large sites, tags otherwise.

Why is the header the same for every version?

Google asks for the full set on each version, including itself.

Does it keep x-default?

Yes, as one more entry.

Is the sitemap output valid XML?

It was parsed with an XML library during testing, and the namespaces are declared.