By SitemapFixer Team
Updated October 2026

Sitemap “Compression Error”: Fixing a Gzipped sitemap.xml.gz

Check your sitemap and 30 of its URLsCheck My Sitemap

Short answer: Search Console reports “Compression error” when Google “encountered an error when trying to uncompress your compressed sitemap file.” The .gz file is broken, isn’t really gzip, or was cut off. Download it, test it with gunzip -t, rebuild it with a standard gzip tool, and resubmit. If you don’t need a .gz file, serving a plain sitemap.xml is simpler.

How gzipped sitemaps work

The sitemaps.org protocol lets you compress a sitemap, a sitemap index or a text sitemap with gzip. The file is usually named sitemap.xml.gz. Google downloads it, uncompresses it, and then reads the XML inside. The size limit still applies to the uncompressed file: 50 MB and 50,000 URLs. See sitemap limits.

Common causes

The file isn’t actually gzip

A plain XML file was renamed to .gz, or a script wrote the wrong format (for example zip instead of gzip).

The file is truncated

The build or upload stopped halfway, so the gzip stream ends early. Large generated sitemaps are the usual victims.

The server changes the bytes

Some server setups compress the response again, or serve an HTML error page at the .gz URL. Check what the URL really returns, not what is on disk.

How to test the file

curl -s -o sitemap.xml.gz https://example.com/sitemap.xml.gz
file sitemap.xml.gz          # should say: gzip compressed data
gunzip -t sitemap.xml.gz     # no output = the archive is intact
gunzip -c sitemap.xml.gz | xmllint --noout -   # the XML inside is valid
curl -sI https://example.com/sitemap.xml.gz | grep -iE '^(HTTP|content-type|content-encoding)'

If file says “HTML document” or gunzip -t reports an error, the problem is the file or the server, not Google. If the XML inside fails xmllint, see sitemap parsing errors.

How to fix it

  1. Rebuild the file with a standard tool, for example gzip -k sitemap.xml, and upload the result in binary mode.
  2. Make sure the build finishes before the file is published, so crawlers never get a half-written file.
  3. Re-run the tests above against the live URL.
  4. Resubmit the sitemap in Search Console’s Sitemaps report.

Or skip compression: list a plain sitemap.xml instead. Web servers typically compress responses on the fly for clients that accept it, so you get most of the bandwidth benefit without a separate file to maintain.

Frequently asked questions

Can I submit a gzipped sitemap to Google?

Yes. The sitemap protocol allows gzip for sitemaps, sitemap indexes and text sitemaps, and Search Console accepts .xml.gz files.

Does gzip let me go over the 50 MB limit?

No. The 50 MB limit counts the uncompressed file. Gzip only saves bandwidth.

Do I need a .gz sitemap?

Usually not. Most sitemaps are small, and web servers already compress responses on the fly. A .gz file mainly helps very large sitemaps that you build ahead of time.

How do I test a .gz sitemap?

Download it and run gunzip -t on it. If that reports an error, Google can’t uncompress it either. Then uncompress it and check the XML with xmllint.

Check that your sitemap reads cleanly
Free - reads your sitemap and tests 30 URLs live
Check My Sitemap Free

Related guides