· 5 min read
How to Extract Every URL From an XML Sitemap
Heshan Fernando
Co-founder & COO
You’ve got a sitemap.xml open in a browser tab, or downloaded as a file, and what you actually need is a plain list of the URLs inside it — to check for orphaned pages, feed into a crawler, cross-reference against Google Search Console, or just count how many pages a competitor’s site claims to have. But it’s wrapped in <urlset> and <url><loc> tags, and copy-pasting that into a spreadsheet leaves you with XML markup mixed in with the actual links.
Some sitemaps make this worse by being sitemap indexes — a sitemap that just lists other sitemaps, each of which lists the real URLs. Untangling a nested sitemap index by hand, especially one covering a site with thousands of pages, is not a five-minute job if you’re doing it by eye.
What sitemap URL extraction actually involves
An XML sitemap is a structured list of a site’s pages wrapped in <loc> tags, sometimes with extra metadata like last-modified date or priority. A sitemap index is one level up — a list of sitemap files rather than pages directly. Extracting URLs means parsing that XML and pulling out just the <loc> values, flattened into a plain list, regardless of which of the two formats you’re given.
For most people the goal is simple: paste in sitemap XML, get back a clean list of URLs, with a count, ready to copy or export.
Why people get stuck here
- Sitemap indexes add a layer. A tool that only reads a single
<urlset>sitemap will silently miss URLs if what you actually pasted was a sitemap index pointing to other sitemap files. - Manual copy-paste drags in markup. Selecting text out of raw XML in a browser tends to grab angle brackets and tag names along with the URLs, which then need manual cleanup.
- Large sitemaps are unwieldy to scroll through. A sitemap with several thousand URLs is hard to review by eye, and easy to lose your place in.
- No quick way to get a count. Knowing “this sitemap has 4,213 URLs” at a glance is often the actual question, not just seeing the list.
What a good sitemap URL extractor looks like
Handles both sitemap types
It should correctly parse a plain <urlset> sitemap and recognize a <sitemapindex> structure, rather than only supporting the simpler of the two.
A clean, copyable list with a count
The output should be just the URLs — one per line, no XML tags — along with a total count, so you know exactly how many pages you’re looking at without counting rows yourself.
A downloadable text file
Being able to export the extracted list as a plain text file means you can drop it straight into a spreadsheet, a crawler’s URL list input, or a comparison script.
Common mistakes to avoid
- Assuming a sitemap index and a regular sitemap are interchangeable inputs — a tool built for one may return an empty or partial result on the other.
- Pasting a truncated copy of a very large sitemap and not noticing the count looks lower than expected.
- Forgetting that a sitemap only reflects what a site chose to list — it’s not a guarantee that every real page on the site is included, or that every listed URL still resolves.
- Treating the sitemap’s
lastmoddates as authoritative without spot-checking a few pages, since some CMS platforms set them automatically regardless of actual edits. - Not deduplicating when combining URLs pulled from multiple sitemap files in an index, if your downstream use case needs a unique list.
How to do it with Sitemap URL Extractor
Online Tool Store’s Sitemap URL Extractor parses the XML locally in your browser — nothing is uploaded to a server.
- Open the tool and paste in your sitemap XML, whether it’s a regular sitemap or a sitemap index.
- The tool parses the
<loc>values and lists every URL found, with a running count. - Review the list, or copy it directly.
- Download the full list as a text file if you need it outside the browser.
Because the parsing happens client-side, it works just as well on a sitemap for a site that isn’t public yet as it does on a live one.
Frequently asked questions
What’s the difference between a sitemap and a sitemap index?
A regular sitemap lists actual page URLs directly. A sitemap index lists other sitemap files instead — it’s used when a site has too many URLs to fit in a single sitemap file (Google’s limit is 50,000 URLs or 50MB uncompressed per file).
Can I extract URLs from a sitemap I only have a link to, not the raw XML?
You’ll need to fetch the XML content first (most sitemaps are viewable by visiting the .xml URL directly in a browser and viewing source, or downloading the file), then paste that content into the extractor.
Does this tool crawl the site to find pages that aren’t in the sitemap?
No — it only reads what’s already listed in the sitemap you provide. It won’t discover pages the sitemap omits; for that, you’d need an actual site crawler.
Final thought
A sitemap is only useful once you can actually see what’s in it — pulling out a clean URL list turns an XML file into something you can audit, compare, or feed straight into the next tool in your workflow.