Configure robots.txt
Output: robots.txt
Test a URL against this robots.txt
text/plain: https://yourdomain.com/robots.txt (subdomains need their own file).
Configure sitemap.xml
Output: sitemap.xml
https://yourdomain.com/sitemap.xml, declare it in robots.txt (Sitemap: …) —
Then submit via Google Search Console
and Bing Webmaster Tools.
Check a live robots.txt
Fetch a live robots.txt and read it the way RFC 9309 and Google do: status code meaning, checks,
AI training preference, per-bot access (search, social, AI & SEO crawlers), groups, declared sitemaps and a URL test with wildcards.
Enter a domain (e.g. example.com) — /robots.txt is appended automatically — or a full URL.
Check a live sitemap.xml
Fetch a sitemap, sitemap index, text sitemap or feed (also .xml.gz) and validate it: well-formed XML,
locations, lastmod, limits, URLs blocked by robots.txt and a status sample of the listed pages.
For a bare domain the sitemaps declared in robots.txt are used, otherwise /sitemap.xml.
Examples
Common configurations for both files. Click Load into Generator to use an example as a starting point.
robots.txt Examples
Allow All Bots
Minimal file — all crawlers allowed, sitemap declared.
Standard Website
Block admin and private areas, internal search results and PDFs (wildcards).
WordPress
WP-Admin closed except admin-ajax.php, search result pages blocked. CSS/JS stay crawlable.
Block AI Training, Allow AI Search
__usage_ai-training states the preference; the listed training crawlers are blocked separately at crawl level, for those who honor robots.txt. AI search and user-triggered fetches (ChatGPT, Claude, Perplexity) stay allowed, with one catch: Google-Extended also ends Gemini grounding (Gemini Apps, Grounding with Google Search on Vertex AI). Google Search inclusion and ranking are not affected.
Block All AI Crawlers
__usage_ai-training states the preference; the listed bots block training, AI search and user-triggered fetches at crawl level, for those who honor robots.txt. Google-Extended also ends Gemini grounding. Search engines stay allowed.
Allow All, Explicit AI Training Preference
All crawlers allowed; __usage_ai-training states a preference in favor of AI training instead of leaving it open.
Sitemap Examples
Simple Website
Four pages with real lastmod dates.
Blog
Dates with time and time zone, a URL with query string (escaped as &).
Shop: Sitemap Index
Large sites split into several sitemaps, listed in an index.
Tips & Best Practices
Guidelines for both files — and how they work together.
robots.txt
Do This
- Provide a
User-agent: *group. It applies to every bot without a group of its own — a bot with its own group ignores*completely. - Link your sitemap. Add
Sitemap: URLso crawlers can discover all your public pages. - Rules are prefixes.
Disallow: /adminalso blocks/administrator;/admin/only the directory. Use*and$for patterns (/*.pdf$). - Test before deploying. Use the live test next to the generator, then the robots.txt report in Search Console after uploading.
- Keep it simple. A few well-chosen Disallow rules are more maintainable than dozens of edge cases.
- State your AI training preference in its own group.
User-agent: __usage_ai-trainingwithDisallow: /orAllow: /. It is not a crawl directive and*does not apply to it, so keep your crawler groups as well.
Avoid This
- Don't use robots.txt for security. Malicious bots ignore it. Use server-side authentication instead.
- Don't block CSS and JS. Google needs them to render and understand your pages.
Disallow: /blocks everything — including your entire website from Google. Double-check this.- Don't put secrets in Disallow paths. The file is public — anyone can read it and find hidden paths.
- Blocking a page doesn't remove it from Google. It can still be indexed from links. Use
noindex(meta tag or header) — and do not block that page, or crawlers never see the noindex. - No blank-line tricks. A blank line does not end a group: agents above share the rules below until the next rule line.
Sitemap
Do This
- Include only canonical URLs. One URL per page, no duplicates with
?utm_*or session parameters. - Use
<lastmod>accurately. Only set it if you actually track the modification date — don't fake it. - Skip
<priority>and<changefreq>. Google ignores both; Bing reads them at most as weak hints. - Split large sites. Keep each sitemap under 50,000 URLs / 50 MB and use a sitemap index file.
- Declare it in robots.txt and submit it.
Sitemap: …in robots.txt, plus Search Console and Bing Webmaster Tools. Large files may be served gzip-compressed (.xml.gz).
Avoid This
- Don't include blocked URLs. If a page is disallowed in
robots.txt, it shouldn't be in the sitemap. - Don't include noindex pages. Search engines won't index them regardless — they clutter your sitemap.
- Don't use relative URLs. All
<loc>values must be fully qualified:https://example.com/page/. - Don't list redirects. Only final URLs — the check tab tests a sample of them.
- Don't list 404 pages. Only include pages that return HTTP 200. Crawlers waste budget on dead links.
How robots.txt and Sitemap Work Together
robots.txt
Tells crawlers what they may not access. It's a policy file, not a security measure. Crawlers obey it voluntarily.
sitemap.xml
Tells crawlers what you want indexed. It's a roadmap — it speeds up discovery but doesn't guarantee indexing.
The Golden Rule
Never list a URL in the sitemap that robots.txt blocks — the sitemap check compares both files for you.
Format Reference
Complete specification for both file formats.
robots.txt Directives
| Directive | Example | Support | Description |
|---|---|---|---|
User-agent |
User-agent: * |
All | Starts a group (product token, case-insensitive). Consecutive lines share one group; groups for the same bot are merged. |
Disallow |
Disallow: /admin/ |
All | Blocks paths starting with the value (path + query). * = any characters, $ at the end = end of URL. Empty value restricts nothing. |
Allow |
Allow: /public/ |
All | Allows a path. The longest matching rule wins; on equal length Allow wins. |
Crawl-delay |
Crawl-delay: 10 |
Most | Seconds between requests. Not supported by Googlebot (use Search Console instead). |
Sitemap |
Sitemap: https://…/sitemap.xml |
All | Absolute URL of a sitemap. Can appear several times, independent of groups. |
__usage_ai-training |
User-agent: __usage_ai-trainingDisallow: / |
Draft | Policy token, not a directive: when it is named in a User-agent line, Disallow states a preference against training generative AI models on a path, Allow one in favor. No group means no preference; * does not apply. Not a crawl directive. |
Content-Signal |
Content-Signal: ai-train=no, search=yes |
Non-standard | Cloudflare's statement of how content may be used (search, ai-input, ai-train). Not a crawl rule. |
Content-Usage |
Content-Usage: train-ai=nContent-Usage: /ai-ok/ train-ai=y |
Draft | IETF AIPREF working group draft, still open. A rule inside a group with an optional path; labels train-ai, ai-use, search, values y and n. Not a crawl rule. |
Host |
Host: example.com |
Obsolete | Was Yandex-only, ignored since 2018 — use redirects to the preferred host. |
Noindex |
Noindex: /page |
None | Never standard, Google stopped honoring it in 2019 — use meta robots or X-Robots-Tag. |
Common Bot Names
| User-agent | Owner / purpose | Type |
|---|
Sitemap XML Elements
| Element | Required | Values | Description |
|---|---|---|---|
<urlset> |
Required | — | Root element. Must include the namespace: xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" |
<url> |
Required | — | Parent element for each URL entry. |
<loc> |
Required | Full URL | Fully-qualified URL including protocol. Max 2048 characters. Must be URL-encoded. |
<lastmod> |
Optional | YYYY-MM-DD |
Last significant change, W3C Datetime (2026-10-15 or 2026-10-15T09:30:00+02:00). Google uses it when it is consistently accurate. |
<changefreq> |
Optional | always / hourly / daily / weekly / monthly / yearly / never | Ignored by Google. |
<priority> |
Optional | 0.0 – 1.0 | Ignored by Google. |
<sitemapindex> / <sitemap> |
Index only | — | Lists up to 50,000 sitemaps (each with <loc>, optional <lastmod>). An index must not list other indexes. |
| Limits | — | 50,000 URLs, 50 MB | Per file, uncompressed. Text sitemaps (one URL per line) and RSS/Atom feeds are accepted too. |
Further Reading
- RFC 9309 — Robots Exclusion Protocol, the standard since 2022
- Google: robots.txt Guide — Google's robots.txt reference including supported directives and syntax
-
draft-kelley-aipref-training-preference-signal
— Individual Internet-Draft behind
__usage_ai-training, not adopted by the IETF AIPREF working group - __usage_ai-training in robots.txt — Blog article on the shared AI training signal
- sitemaps.org Protocol — Official Sitemaps Protocol specification
- Google: Sitemaps Guide — Build and submit a sitemap to Google Search
- Google Search Console — robots.txt report and sitemap submission