Serving site files: media types, encoding and status codes
Which Content-Type each machine-readable file should be served with, why UTF-8 matters, and how crawlers react to redirects, client errors and server errors when they request robots.txt.
Type: IntermediateOn this page
A correct file can still fail if the server delivers it badly. A robots.txt that returns 503 during a deployment can stop a search engine from crawling the whole site, and an llms.txt served as text/html looks to a client like any other web page. Before reading the rules below, look at what the server actually sends. The -I option makes curl send a HEAD request and print only the response headers:
curl -I https://example.com/robots.txt
curl -I https://example.com/llms.txt
curl -sI https://example.com/sitemap.xml | grep -i '^content-type'A well-configured server answers the first command along these lines:
HTTP/1.1 200 OK
Content-Type: text/plain; charset=utf-8
Cache-Control: max-age=86400
Last-Modified: Thu, 03 Dec 2026 09:00:00 GMTLook at three parts of that response: the status code, the media type and the character set. The Cache-Control value is optional; Google says it may adjust how long it caches robots.txt based on max-age.
Media types by file
| File | Content-Type | Rule and source |
|---|---|---|
| /robots.txt | text/plain; charset=utf-8 | RFC 9309 section 2.3: the file MUST be UTF-8 encoded and of media type text/plain. |
| /llms.txt and .md pages | text/markdown; charset=utf-8, or text/plain; charset=utf-8 | text/markdown is registered by RFC 7763 (March 2016), which makes the charset parameter required. The llms.txt proposal does not set a media type. |
| Sitemap | application/xml | The Sitemaps protocol requires UTF-8 and allows gzip compression but does not name a media type. application/xml is the registered type for XML (RFC 7303). |
| JSON files | application/json | RFC 8259 section 8.1 requires UTF-8 between systems outside a closed ecosystem and forbids adding a byte order mark. Section 11 defines no charset parameter; adding one has no effect on compliant recipients. |
| /.well-known/security.txt | text/plain; charset=utf-8 | RFC 9116 section 3: served over HTTPS as text/plain with the charset parameter set to utf-8. |
Real documentation sites differ on llms.txt. When LLMSdocs requested them on 5 December 2026, docs.stripe.com/llms.txt was served as text/markdown and developers.openai.com/llms.txt as text/plain, both with charset=utf-8. Both are acceptable; what breaks clients is text/html, or a missing charset on a file that contains non-ASCII characters.
Encoding
Every format on this site expects UTF-8. Save files without a byte order mark: RFC 8259 forbids one at the start of networked JSON, and while Google says it ignores a BOM at the start of robots.txt, other parsers are not required to. RFC 9309 section 2.2.2 has crawlers percent-encode non-ASCII octets in both the URL and the rule before comparing them, so a path written as /café/ and one written as /caf%C3%A9/ match the same URLs. That holds only if the file really is UTF-8: Google warns that in a file with another encoding it may ignore characters outside the UTF-8 range, which can make such rules invalid.
How crawlers treat robots.txt responses
robots.txt is the one file whose HTTP status code changes crawler behavior across the whole site. RFC 9309 sections 2.3.1.1 to 2.3.1.4 define four outcomes. Google documents its own handling on its robots.txt specification page, and in places it is more detailed than the RFC.
| Response | RFC 9309 | |
|---|---|---|
| 2xx | The crawler MUST follow the parseable rules. | Processes the file as served. |
| 3xx | SHOULD follow at least five consecutive redirects, even to another host; the rules then apply to the original host. After more than five, MAY treat the file as unavailable. | Follows at least five redirect hops, then treats the file as a 404. |
| 4xx | Unavailable: the crawler MAY access any resource on the server. | All 4xx except 429 are treated as if no robots.txt existed. Google says not to use 401 or 403 to limit crawl rate. |
| 429 | Not singled out; falls in the 4xx range. | Handled like a 5xx error. |
| 5xx or network failure | Unreachable: the crawler MUST assume complete disallow. If this lasts a long time, such as 30 days, it MAY treat the file as unavailable or keep using a cached copy. | Stops crawling for the first 12 hours while retrying, then uses the last good copy for up to 30 days. After about 30 days, if the site is otherwise available, behaves as if there were no robots.txt. |
The practical reading is that a missing robots.txt (404) is harmless, while a broken one (500 or 503) blocks crawling. A server that answers unknown paths with 200 and an HTML page is a third case. Google says it then tries to extract rules from the HTML and ignores everything else, so the result depends on whatever lines happen to parse.
Size and caching limits
- Parsing limit. RFC 9309 section 2.5 lets crawlers stop parsing after a limit, which MUST be at least 500 kibibytes. Google enforces exactly 500 KiB and ignores content after it.
- Cache lifetime. Under section 2.4, crawlers SHOULD NOT use a cached robots.txt for more than 24 hours unless the file is unreachable. Google says it generally caches for up to 24 hours. A rule change can therefore take a day to reach every crawler.
- Sitemaps. 50,000 URLs and 50 MB (52,428,800 bytes) uncompressed per file, gzip or not. See Sitemap XML format.
See also
- Where site files live: the root path and /.well-known/Clients find machine-readable site files at fixed addresses: some at the root of each host, some under the /.well-known/ prefix of RFC 8615, and some inside every page. Where a file sits also decides which URLs it can speak for.
- Publishing JSON files: media type, encoding and parsingThe rules a published JSON file has to follow under RFC 8259, how to serve it over HTTP, and how to write, read, format and validate it with Python's json module without producing output that other parsers reject.
- robots.txt syntax: groups, rules and matchingReference for the robots.txt file format as standardized in RFC 9309: groups and user-agent lines, allow and disallow rules, the * and $ characters, comments, and the longest-match rule that decides which line applies to a URL.
- security.txt: publishing a security contactThe security.txt format defined in RFC 9116: where the file must be served, the two required fields Contact and Expires, the optional fields, signing, and the scope of a single file.
- Markdown versions of pages and llms-full.txtThe llms.txt proposal asks sites to offer a clean Markdown copy of useful pages at the page's own URL with .md added, and to announce it with standard link relations. llms-full.txt, a single file holding a whole site, is a platform convention outside the proposal.
References
- RFC 9309: Robots Exclusion Protocol, sections 2.3 to 2.5 rfc-editor.org
- How Google interprets the robots.txt specification. Google Crawling Infrastructure documentation developers.google.com
- Leonard, S. RFC 7763: The text/markdown Media Type. IETF, March 2016 rfc-editor.org
- Bray, T. (ed.) RFC 8259: The JavaScript Object Notation (JSON) Data Interchange Format, sections 8.1 and 11. IETF, December 2017 rfc-editor.org
- RFC 7303: XML Media Types. IETF, July 2014 rfc-editor.org
- RFC 9116: A File Format to Aid in Security Vulnerability Disclosure, section 3 rfc-editor.org
- Sitemaps XML format, sitemaps.org sitemaps.org