account_tree
LinkExtractor.
Tutorials•7 min read•Updated 2026-10-25

How to Count Links in XML Sitemap (2026 Guide: Free, Instant & Accurate)

Learn 4 proven ways to count URLs in any XML sitemap or sitemap index. Compare Python scripts, terminal regex, Google Search Console, and the 1-click Chrome Extension.

#sitemap-counter#technical-seo#xml-sitemap#chrome-extension#seo-audit
lightbulbKey Takeaways (TL;DR)

Counting XML sitemaps doesn't require slow cloud crawlers or python scripts. Using the free LinkExtractor Chrome Extension, you can count links, audit hreflang tags, verify lastmod freshness, and export data in 1 click right inside your browser with zero tab freeze.

Why Counting URLs in XML Sitemaps Is Critical for SEO

Every technical SEO audit begins with one fundamental question: How many discoverable URLs does this website actually intend for search engines to crawl and index?

Whether you are auditing an e-commerce site with hundreds of thousands of product variants or validating a migration on WordPress, knowing the exact count of <loc> tags in your XML sitemaps is critical:

  • Detect Ghost URLs & Index Bloat: Ensure outdated tags, staging URLs, or 404 pages aren’t polluting your crawl budget.
  • Enforce the 50,000 URL Limit: Google strictly caps any single XML sitemap at 50,000 URLs and 50MB. Exceeding this causes Googlebot to ignore trailing URLs completely.
  • Audit Sub-Sitemap Balance: For websites with multi-locale stores or localized categories, verifying URL distribution across sub-sitemaps prevents indexing blind spots.

Below, we breakdown the four most common ways to count links in an XML sitemap, from terminal hacks to the fastest 1-click browser method.


Method 1: The 1-Click Browser Extension (Fastest & Easiest)

If you need to verify sitemap counts quickly without installing Python packages, terminal commands, or paid crawl software, the easiest method is the free LinkExtractor Chrome Extension.

How It Works:

  1. Install LinkExtractor from the Chrome Web Store.
  2. Open any XML sitemap URL in your browser (e.g., https://example.com/sitemap.xml).
  3. An on-screen floating Live HUD Badge instantly displays the total URL count in the corner of your page.
  4. Click the extension icon to view deeper breakdowns:
    • Total <loc> entries
    • <xhtml:link rel="alternate"> hreflang counts
    • <image:loc> count
    • Detection of <sitemapindex> vs <urlset>
    • 1-click Export to CSV / JSON
+-------------------------------------------------------------+
|  LinkExtractor On-Screen HUD                                |
|  [ 12,480 URLs Counted ]  •  Sitemap Index  •  Fresh: Today  |
+-------------------------------------------------------------+

Pro Tip: Unlike native Chrome which freezes trying to render 40,000 XML nodes into an interactive tree, LinkExtractor hooks directly into Chrome’s scripting engine to extract tag counts in sub-100ms.


Method 2: Terminal / cURL & Regex (For Developers)

If you are on macOS or Linux and have terminal access, you can fetch and parse the XML sitemap using curl and grep:

# Count URLs in a standard sitemap
curl -s https://example.com/sitemap.xml | grep -o "<loc>" | wc -l

# Count URLs in a gzipped sitemap (.xml.gz)
curl -s https://example.com/sitemap.xml.gz | gunzip -c | grep -o "<loc>" | wc -l

Limitations of Terminal Counting:

  • Fails on Cloudflare/bot-protected sitemaps (returns HTTP 403 / captcha).
  • Does not distinguish between <url><loc> (actual page URLs) and <sitemap><loc> (sub-sitemaps).
  • Does not audit hreflang tags or export structured CSVs.

Method 3: Python Script with BeautifulSoup or lxml

For automated batch workflows across hundreds of client sites, you can write a lightweight Python script:

import requests
from bs4 import BeautifulSoup

def count_sitemap_urls(url):
    headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)'}
    response = requests.get(url, headers=headers)
    soup = BeautifulSoup(response.content, 'xml')
    
    # Check if this is a sitemap index or standard urlset
    if soup.find('sitemapindex'):
        sitemaps = soup.find_all('sitemap')
        print(f"Sitemap Index Detected! Found {len(sitemaps)} sub-sitemaps.")
        return len(sitemaps)
    else:
        urls = soup.find_all('url')
        print(f"Standard URLSet Detected! Found {len(urls)} URLs.")
        return len(urls)

# Example usage
count_sitemap_urls("https://example.com/sitemap.xml")

Method 4: Google Search Console (Sitemaps Report)

If you have verified property ownership in Google Search Console:

  1. Navigate to Indexing → Sitemaps in the left sidebar.
  2. Under “Submitted sitemaps”, locate your sitemap index or child sitemap.
  3. Check the Discovered pages column.

Why GSC Discovered Counts Often Mislead:

  • GSC shows cached numbers that can lag by 3 to 14 days.
  • It only reflects URLs Google chose to process, not necessarily all raw <loc> tags present in the live XML file.
  • You cannot inspect competitors’ sitemaps in GSC.

Summary Comparison Table

Method Speed Live XML Accurate Handles Sitemap Indexes Hreflang Audit Cost
LinkExtractor Chrome Extension Instant (1-click) Yes (100% real-time) Yes (Auto-detected) Yes Free Forever
Terminal / cURL 10–30s Yes Requires custom script No Free
Python (BeautifulSoup) 1–5 min Yes Requires script logic Manual Free
Google Search Console Lagged (days) No (Filtered) Partial No Free (Owner Only)
Screaming Frog 5–15 min Yes Yes Yes $259/year

Conclusion & Next Steps

Counting sitemap links should not require setting up a developer environment or paying hundreds of dollars for desktop crawler licenses.

Install the free LinkExtractor Chrome Extension today to count URLs, validate hreflang tags, and audit XML sitemaps instantly on any page you visit.

Instant 1-Click Browser Workflow

Stop Counting Sitemap Links Manually

Install LinkExtractor Chrome Extension for real-time on-page counters, hreflang auditors, and CSV export directly in Chrome.

Knowledge Base

Frequently Asked Questions

Got questions related to this guide? Find quick, direct answers below.

★ 4.9 / 5.0 Star Rating•Chrome Web Store Verified

Loved by SEO Pros, Developers & Marketers

See how thousands of users streamline their technical SEO audits and XML sitemap counting with LinkExtractor.

4.9/ 5.0
★★★★★

Based on 352+ verified ratings on Chrome Web Store & community

5 Stars
94%
4 Stars
5%
3 Stars
1%
2 Stars
0%
1 Stars
0%
Chrome Store Reviewsopen_in_new
★★★★★
verifiedVerified User

"This extension saves me at least 30 minutes every audit. Chrome usually freezes when opening 45,000 URL sitemaps, but LinkExtractor stream engine handles it in under a second flat. Essential tool."

Sarah Jenkins

Sarah Jenkins

Senior Technical SEO @ MetricScale

2 days ago
★★★★★
verifiedVerified User

"The Sitemap Hunter tool built into this extension found hidden sitemaps on our competitor sites in 3 seconds. The CSV export with hreflang breakdown is cleaner than Screaming Frog outputs."

Marcus Vance

Marcus Vance

Growth Lead @ SaaSify

1 week ago
★★★★★
verifiedVerified User

"Zero permissions creep, runs entirely offline in browser memory, no telemetry. The on-page floating badge means I don't even need to open the popup. Indispensable."

Elena Rostova

Elena Rostova

Freelance SEO Consultant

2 weeks ago
★★★★★
verifiedVerified User

"We manage 20+ publications with complex sitemap indexes. Checking if sub-sitemaps were properly indexed took forever before. Now it's literally 1 click."

David Chen

David Chen

Head of Content @ TechPulse

3 weeks ago
Zero Lag • 100% Free • Manifest V3

Ready for Instant Sitemap Intelligence?

Stop crashing browser tabs and waiting on slow crawlers. Count URLs, audit hreflang tags, and generate llms.txt files in seconds.

✓ No credit card•✓ No account required•✓ 0 data collected