// SEO Guides
Sitemap vs Robots.txt: What is the Difference?
Two of the most common terms in technical SEO are robots.txt and sitemap.xml. While they both deal with how search engines interact with your website, they serve two completely different purposes.
To put it simply: a robots.txt file tells search engines where they are not allowed to go, while a sitemap tells them exactly where you want them to go.
Because they work together, it is a best practice to list your XML file inside your robots file. This allows search engines to find it immediately. You can test this yourself by using our tool to find a sitemap in robots.txt just by entering a domain name.
The Role of Robots.txt
The robots.txt file acts as the bouncer for your website. When Googlebot arrives at your domain, the very first file it looks for is /robots.txt.
Inside this file, you can write directives that block bots from crawling specific pages or directories. For example, you probably do not want Google crawling your admin dashboard, your user login pages, or your internal search result pages.
- Primary function: Controlling crawl budget and restricting access.
- Format: Plain text file (
.txt). - Location: Always at the root of your domain (
example.com/robots.txt).
The Role of an XML Sitemap
Once the bouncer (robots.txt) lets the search engine in and tells it which rooms are off-limits, the crawler needs a map to navigate the rooms that are allowed. That map is your XML file.
Instead of blocking pages, this file actively provides a list of all your important, public-facing pages that you want to appear in search results.
- Primary function: Speeding up discovery and indexing.
- Format: XML file (
.xml). - Location: Can be hosted anywhere on your domain, though usually at the root (
example.com/sitemap.xml).
Working Together
The most efficient way to set up technical SEO for a new website is to use both files together.
- Use
robots.txtto block private or low-value pages. - Build an XML file listing only your high-value pages.
- Add a line at the very bottom of your
robots.txtfile that points directly to your XML file, like this:
Sitemap: https://yourwebsite.com/sitemap.xml