Your XML sitemap is a complete list of the pages you want indexed, but it is wrapped in XML tags that make it awkward to actually use. Being able to extract URLs from a sitemap, pulling out a clean, plain list of every page, is a surprisingly handy skill for audits, migrations and content inventories. This guide explains why you would want that list, how sitemaps are structured, and how to get every URL in seconds.
Why extract the URLs?
A plain list of your URLs is the starting point for a lot of SEO work:
- Content audits, a full inventory of your pages to review, categorise or prune.
- Site migrations, a checklist of every URL that must be redirected or recreated.
- Bulk checking, feeding the list into tools that check status codes, indexing or metadata at scale.
- Coverage checks, comparing what is in the sitemap against what is actually indexed or crawled.
In each case you need the URLs as a clean list, not buried inside XML, so extraction is the practical first step.
How sitemaps are structured
An XML sitemap wraps each page URL in a <loc> tag inside a <url> element, often alongside metadata like <lastmod>. Extracting the URLs simply means pulling out the contents of every <loc>:
| In the sitemap | What you want |
|---|---|
| <url><loc>https://site.com/page</loc></url> | https://site.com/page |
Do that for every entry and you have your list. The only wrinkle is that large sites often split their sitemap into several files.
Sitemap indexes and multiple files
Big sites hit the sitemap size limit (50,000 URLs or 50MB per file), so they use a sitemap index, a master file that lists other sitemap files rather than pages. When you extract URLs, you need to handle this: if the file you are looking at is an index, follow each child sitemap and extract the URLs from those. Otherwise you will end up with a list of sitemap files, not pages. A good extractor detects an index and pulls the URLs from all the referenced sitemaps automatically, so you get the complete set of pages rather than a partial list or a list of the wrong thing.
Watch for what the sitemap does and doesn’t tell you
A sitemap is a list of the URLs you declared for indexing, which is not always the same as what is really happening. Some pages in the sitemap may be noindexed, redirected, or returning errors; and some indexed pages may be missing from the sitemap entirely. So treat the extracted list as your “intended” set of pages, then compare it against reality, crawl the URLs to check status codes and indexability, and cross-reference with Search Console coverage. The gap between “in the sitemap” and “actually indexed and healthy” is exactly where useful SEO findings live, orphaned pages, stale entries, accidental noindexes. Extraction gives you the list; the audit comes from comparing that list to what is truly indexed.
Extract your sitemap URLs online
You do not need a script for this. Our free sitemap URL extractor takes a sitemap URL or pasted XML and returns a clean, copyable list of every page, handling sitemap indexes and multiple files so you get the complete set. From there, validate the sitemap itself with our sitemap validator, and if you need to build or fix one, see our guide to what an XML sitemap is.
The takeaway
Extracting the URLs from your sitemap gives you a clean inventory of your pages, the foundation for content audits, migrations and bulk checks. Sitemaps store each URL in a <loc> tag, and large sites use a sitemap index that points to multiple files, so make sure your extraction follows the index to capture everything. Then compare the list against what is actually indexed to find the real issues. Pull every URL with our sitemap URL extractor, and explore the rest of our free SEO tools.