Skip to content

File Format

Complete llms.txt format specification

The llms.txt file uses Markdown format with a defined structure. It is placed at the site root at /llms.txt.

# H1 Title (required)
> Blockquote with brief description (recommended)
Additional description text (optional)
## H2 Section (optional)
- [Link Name](URL): Resource description
- [Another Link](URL): What this resource contains
## Optional
- [Additional Resource](URL): Can be skipped when context is limited

The only required element is a first-level heading with the project name:

# FastHTML

or

# API Documentation v2

Brief project description in 1-2 sentences:

> FastHTML is a Python library for building fast web applications
> using HTMX and modern web standards.

Additional information after the blockquote:

Key features:
- No JavaScript frameworks required
- Server-Side Rendering support
- FastAPI integration

Each section starts with an H2 heading:

## Documentation
- [Quick Start](https://example.com/quickstart): Start here
- [Installation](https://example.com/install): System requirements and installation

Each link consists of:

- [Name](URL): Description
ElementRequiredExample
NameRequired[API Reference]
URLRequired(https://docs.example.com/api)
DescriptionRecommended: Complete endpoint documentation
- [Getting Started](https://docs.example.com/start): Quick start in 5 minutes
- [API Reference](https://docs.example.com/api): REST API documentation
- [Examples](https://github.com/example/repo/examples): Code examples on GitHub

The ## Optional section has special meaning:

## Optional
- [Changelog](https://example.com/changelog): Version history
- [Contributing](https://example.com/contributing): Contributor guide
- [Advanced Topics](https://example.com/advanced): In-depth topics
https://example.com/llms.txt

For site subsections, you can create separate files:

https://example.com/docs/llms.txt
https://example.com/api/llms.txt

It’s recommended to provide .md versions of HTML pages:

https://example.com/page.html → https://example.com/page.html.md
https://example.com/docs/ → https://example.com/docs/index.html.md

Some projects generate additional files:

FilePurpose
llms.txtBase file with links
llms-full.txtFull content of all pages
llms-small.txtMinimal version
llms-ctx.txtContext without URLs (for prompt insertion)

The file can be parsed with simple regex (~20 lines of code):

import re
def parse_llms_txt(content: str) -> dict:
result = {'title': '', 'description': '', 'sections': {}}
# Extract H1
h1_match = re.search(r'^# (.+)$', content, re.MULTILINE)
if h1_match:
result['title'] = h1_match.group(1)
# Extract blockquote
bq_match = re.search(r'^> (.+)$', content, re.MULTILINE)
if bq_match:
result['description'] = bq_match.group(1)
# Extract sections and links
current_section = 'default'
for line in content.split('\n'):
if line.startswith('## '):
current_section = line[3:].strip()
result['sections'][current_section] = []
elif line.startswith('- ['):
match = re.match(r'- \[(.+?)\]\((.+?)\)(?:: (.+))?', line)
if match:
result['sections'].setdefault(current_section, []).append({
'title': match.group(1),
'url': match.group(2),
'description': match.group(3) or ''
})
return result

Check your llms.txt:

  1. Has H1 title
  2. All links work
  3. Descriptions are informative for LLM
  4. No duplicate links
  5. Optional section contains only secondary resources