To extract all URLs from a sitemap, open the sitemap's source code, copy everything, and pull out the address inside each <loc> tag. Our free URL extractor does the pulling for you: paste the XML, press Submit, and you get one URL per line plus a count. It reads & as & and skips mailto:, tel: and similar links, but before you trust the list you still need to clean two things: namespace lines and duplicates.
The URL extractor is free, needs no account and works in any browser, with nothing to install. The text is processed on our server to find the links. Visitors get 5 tool uses a day, and a free My Botsy account (100% free, no spam) removes that cap. Every number below comes from runs on the live tool on November 1, 2026, using our own sitemap and a test sitemap we built to break things.
How to extract URLs from a sitemap, step by step
- Find the real sitemap address. Open
https://the-site.com/robots.txtand look for a line that starts withSitemap:. Don't assume/sitemap.xml: on mybotsy.com that address returns a 404, and robots.txt points tohttps://mybotsy.com/sitemapinstead. Common defaults are/wp-sitemap.xml(WordPress core),/sitemap_index.xml(Yoast SEO) and/sitemap.xml(Shopify and many others). - Open the source, not the pretty view. Some sitemaps are styled into a table in the browser. Type
view-source:in front of the address (Chrome, Edge, Firefox) or press Ctrl+U, then Ctrl+A and Ctrl+C. The source is what the crawler reads. - Paste the source as it is. In the XML, every
&in a query string is stored as&. You don't need to fix that: since November 1, 2026 the extractor turns it back into&, so?color=red&size=42comes out as?color=red&size=42. - Paste into the URL extractor and press Submit. You get a Count and a result box with one URL per line. Click the copy icon to copy the whole list.
- Delete the namespace lines. The first line is almost always
http://www.sitemaps.org/schemas/sitemap/0.9. That isn't a page; it's the sitemap's namespace declaration. Image and hreflang sitemaps add more, such ashttp://www.w3.org/1999/xhtml. - Remove duplicates and sort. Paste the list into the duplicate lines remover, then into the list alphabetizer. Sorting groups the namespace lines and any other domain (an image CDN, for example) together so they're easy to spot and delete. Our guide to removing duplicate lines and sorting lists covers the finer points, like trailing spaces.
- If you got sitemaps instead of pages, repeat. A sitemap index lists other sitemaps, not pages. Open each child sitemap and run steps 2 to 6 on it.
Worked example 1: our own sitemap index
We pasted the source of https://mybotsy.com/sitemap (3,813 bytes) into the URL extractor. Result: Count 27. The first line was the namespace, and the other 26 were child sitemaps: https://mybotsy.com/sitemap/main plus one tools sitemap per language, from /sitemap/tools/ar to /sitemap/tools/vi. Not a single page. That's what an index looks like, and it's the most common reason people think a sitemap extraction "didn't work".
Next we opened https://mybotsy.com/sitemap/main, a 65,107-byte file, and pasted its source. Result: Count 450, which is 449 page URLs plus the namespace line. To double-check, we counted the <loc> tags with a command-line one-liner and got the same 449, and running the list through the duplicate lines remover removed nothing. The English slice had 40 URLs: the home page, contact, the blog, six tool section pages, four /page/ URLs, five blog categories and 22 blog posts (that was before this article went live, so the count is now higher).
That breakdown is the useful part. Once you have the list, you can compare it with what you expected to be there, or with the pages Google reports as indexed in Search Console, and see what's missing or shouldn't be listed at all.
Worked example 2: a sitemap built to break extractors
Real sitemaps contain more than plain <loc> URLs. We wrote a seven-<loc> test sitemap for an imaginary store, shop.example.com, with an hreflang alternate, an image tag, a query string, a CDATA block, parentheses, an accented letter and two repeated pages. Pasted unedited on November 1, 2026, the extractor returned Count 12:
| In the sitemap | What came out | Fix |
|---|---|---|
| Namespace declarations (3) | 3 extra lines like http://www.sitemaps.org/schemas/sitemap/0.9 | Delete them |
<xhtml:link hreflang="es" href=".../es/"> | https://shop.example.com/es/ | Expected: alternates are URLs too |
<image:loc> on a CDN | https://cdn.example.com/img/red-shoe.jpg | Delete if you only want pages |
/shoes?color=red&size=42 | /shoes?color=red&size=42 | None |
<![CDATA[/sale?utm_source=mail&utm_medium=email]]> | Full URL, correct | None |
/guide/sizing-(eu-vs-us) | /guide/sizing-(eu-vs-us) | None |
/café-menu | /café-menu | None (browsers send it as caf%C3%A9-menu) |
The duplicate lines remover then cut the 12 lines to 10 (the home page was listed twice as a <loc>, and /es/ appeared once as an hreflang alternate and once as its own <loc>). Sorted with the list alphabetizer, the three namespace lines landed at the top and the CDN image right after them, so the cleanup took seconds.
The lesson: the count you get is not your page count until you've removed namespaces, alternates you don't want, images and duplicates.
Pitfalls that give you a wrong URL list
The & trap (handled since November 1, 2026)
The sitemap protocol at sitemaps.org requires every data value to be entity-escaped, so a URL with & in it must be written as &. Tools that read the raw text, rather than parsing XML, see the semicolon. Until November 1, 2026 our extractor stopped there and kept only ?color=red&. It now decodes the entities first and returns ?color=red&size=42. The classic one-liner grep -o '<loc>[^<]*' still leaves & in the URL, which is wrong if you then request it.
Where a URL ends
We ran more cases through the extractor. Percent-encoded URLs, ports (:8443), Punycode domains (xn--mnchen-3ya.de), international domains and paths (münchen.de, пример.рф/путь) and characters such as ; ! ' * $ ( ) [ ] are kept whole. A URL ends at a space, a quote or <, and punctuation after it, such as a final period, a comma or an unmatched closing bracket, is dropped, so see https://a.com/end. gives https://a.com/end. Links that aren't web addresses, such as mailto:, tel:, javascript:, data: and anchors that are only #, are left out.
Mixing up an index and a sitemap
If the root tag is <sitemapindex>, every <loc> is another sitemap. Big sites split their URLs because a single sitemap may list at most 50,000 URLs and be at most 50 MB (52,428,800 bytes) uncompressed. Files ending in .xml.gz are gzip-compressed: your browser will download them instead of showing them, so unzip them first (7-Zip on Windows, double-click on a Mac).
Trusting the sitemap as a list of live pages
A sitemap is what the site claims, not proof. A sitemap that isn't regenerated automatically can go on listing deleted pages, redirected URLs and old http:// addresses long after they changed. Spot-check suspicious URLs with the URL redirect checker (our guide on how to check if a redirect is 301 or 302 explains the results), and check that each page's tags are right with the meta tags checker.
What to do with the list
- Audit against Search Console. Compare your list with the indexed pages Google reports and look for what's missing or listed by mistake.
- Plan a migration. The sorted old-URL list is the left column of your redirect map.
- Clean up URL structure. Long, messy paths jump out in a sorted list. Our guide to SEO-friendly URL slugs and the slug generator help with the fixes.
- Check a page's parts. The URL parser splits any URL into host, path and query parameters, handy for spotting tracking parameters that shouldn't be in a sitemap. Our UTM parameters guide explains why
utm_links belong in campaigns, not in sitemaps.
Frequently asked questions
How do I get a list of all URLs on a website from its sitemap?
Find the sitemap in robots.txt, open its source, replace & with &, and paste it into the URL extractor. Delete the namespace lines, remove duplicates, and repeat for each child sitemap if it's an index.
Why did I get sitemap links instead of page URLs?
You opened a sitemap index. Its <loc> tags point to other sitemaps; ours returned 26 child sitemaps and no pages. Open each one and extract again.
Why is the first URL http://www.sitemaps.org/schemas/sitemap/0.9?
That's the XML namespace every valid sitemap declares in its root tag. It looks like a URL, so extractors list it. Delete it; it isn't one of the site's pages.
Does the extractor handle & in sitemaps?
Yes. Sitemaps must store & as &, and since November 1, 2026 the extractor converts it back, so query strings come out whole. You no longer need to replace it in a text editor first.
Can I extract URLs from a .xml.gz sitemap?
Yes, after unzipping it. Compressed sitemaps download as files; extract the .xml inside, open it in a text editor and paste its contents into the tool.
Is the URL extractor free?
Yes. It's free with no account needed and nothing to install. Visitors get 5 tool uses a day, and a free account (no spam) removes the limit.
Ready to pull your list? Open the free URL extractor, paste your sitemap's source, and clean the result in two clicks with the duplicate lines remover and list alphabetizer.