Skip to content
Nazmul Nikhil
Menu

Sitemap.xml Files Have Format Errors (Semrush): Fix Your XML Sitemap

Semrush found errors in your XML sitemap's format, so search engines may not read it. Here's what a valid sitemap looks like and how to fix common errors.

Nazmul Nikhil

By

Head of SEO & Assistant Manager, Digital Marketing at Notionhive

Published 1 min read
Sitemap.xml Files Have Format Errors (Semrush): Fix Your XML Sitemap
Photo: Tanja Tepavac on Unsplash

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 &amp;
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

  1. Open the sitemap URL in a browser. Most browsers show where the XML breaks.

  2. 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.

  3. Resubmit in Search Console > Sitemaps.

This guide isn't affiliated with or endorsed by Semrush.

Sources and references

TAGSSemrush Site AuditSemrush sitemap format errorsSitemap.xml format errorsInvalid sitemap
Nazmul Nikhil

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.

Need help with this?

Get it fixed with Technical SEO

I find the issues that cost you traffic and fix them, starting with the pages that matter most.

Keep reading

Related articles

All Site Audit Issues posts →

Get the next guide in your inbox

One email when a new SEO or AI search guide goes live.

Ready to grow?

Get a free audit of your website, or book a 30-minute call to talk through your goals.

Nazmul Hasan

Talk to Nazmul directly

Reply within 24h

WhatsApp +880 1682835118
nazmulnikhil@gmail.com