In short
Semrush flags "Sitemap.xml files have format errors" when a sitemap doesn't follow the sitemap protocol: broken XML, wrong tags, unescaped characters or files over the size limits. Fix the generator (usually your SEO plugin or platform), not the file by hand, then resubmit in Search Console.
If a sitemap isn't valid XML, search engines may reject all of it, not just the bad line.
A valid sitemap
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://example.com/services/seo-audit/</loc>
<lastmod>2026-11-20</lastmod>
</url>
</urlset>Common errors
| Error | Fix |
|---|---|
Unescaped & in URLs |
Write & |
Relative URLs in <loc> |
Use full absolute URLs |
| Wrong or missing namespace | Use the sitemaps.org namespace |
| Over 50,000 URLs or 50 MB uncompressed | Split into several sitemaps with an index |
PHP warnings or blank lines before <?xml |
Fix the plugin or theme error causing the output |
| Dates in the wrong format | Use W3C format (YYYY-MM-DD) |
How to fix it
Open the sitemap URL in a browser. Most browsers show where the XML breaks.
WordPress: use one sitemap source (Yoast, Rank Math or core), and turn the others off. Shopify, Webflow and Wix: sitemaps are generated automatically; errors usually come from custom-coded sitemap files. Custom builds: generate the sitemap with an XML library, not string joining.
Resubmit in Search Console > Sitemaps.
This guide isn't affiliated with or endorsed by Semrush.
Related issues
Sources and references
Semrush Knowledge Base, What Issues Can Site Audit Identify?
sitemaps.org, Sitemaps XML format
Google Search Central, Build and submit a sitemap

About the author
Nazmul Nikhil
Head of SEO & Assistant Manager, Digital Marketing at Notionhive
SEO and AI search consultant in Dhaka, Bangladesh, helping small and mid-size businesses in the USA, UK, Australia and Canada.



