Skip to content
codewithanjum
AI SEO

What is llms.txt? Format, example and whether it helps

What llms.txt is, who proposed it, the exact format with an example, how to generate one at build time in Astro, and an honest look at who actually reads it.

By Md Anjum Kamali · · 5 min read

Painting of an open laptop on a desk at dusk with a chat bubble and paper planes flying out of the screen
On this page
  1. Who proposed llms.txt and why?
  2. What does an llms.txt file look like?
  3. llms.txt vs robots.txt vs sitemap.xml
  4. Does llms.txt actually help?
  5. How to generate llms.txt at build time in Astro
  6. Common llms.txt mistakes
  7. Should you add one?
  8. Questions people ask

llms.txt is a Markdown file you put at yoursite.com/llms.txt that gives AI models a short summary of your site and a curated list of links to your most useful pages. It was proposed in September 2024 as a way to help language models read a website without wading through menus and scripts. It's a proposal, not an official standard, and no major AI search engine has confirmed it uses the file to rank or cite sites.

llms.txt is a plain Markdown file with a title, a one-paragraph summary and sections of links, written so an AI model can understand what a site is about and which pages to read first.

Below is the exact code that builds this site's llms.txt, plus an honest read on what to expect from it, which is less than most posts on this topic promise.

Who proposed llms.txt and why?

The llms.txt proposal was written by Jeremy Howard, co-founder of Answer.AI, and published on 3 September 2024. The page now carries a v2, which he describes as updated based on two years of adoption.

The problem it solves is real. Language models have limited context, and a normal web page is mostly noise for them: menus, cookie banners, scripts, footers. If an AI tool wants to understand your docs, it has to fetch many pages and strip each one. A single file that says "here's what this is, here are the pages that matter, in clean Markdown" saves that work.

It was mainly aimed at documentation. A developer can hand a coding assistant one URL and the assistant can find the right pages from there.

What does an llms.txt file look like?

The format is Markdown with a fixed order. From the spec:

  1. An H1 with the name of the site or project. This is the only required part.
  2. A blockquote with a short summary.
  3. Optional paragraphs or lists with more detail (no headings).
  4. Zero or more H2 sections, each a list of links in the form [name](url): notes.

An H2 called Optional has a special meaning: links an AI can skip when it needs a shorter context.

Here's a small example for a SaaS product:

# Acme Invoicing

> Acme is invoicing software for freelancers. It creates invoices, sends reminders and tracks payments in 30+ currencies.

Acme has a free plan and a paid plan. The API is REST with JSON responses.

## Docs

- [Quick start](https://acme.example/docs/quick-start.md): Create an account and send your first invoice
- [API reference](https://acme.example/docs/api.md): Every endpoint with request and response examples

## Product

- [Pricing](https://acme.example/pricing): Plans and limits
- [Integrations](https://acme.example/integrations): Stripe, PayPal and accounting tools

## Optional

- [Changelog](https://acme.example/changelog): Release notes by month

The spec also suggests offering a clean Markdown copy of important pages at the same URL with .md added, like /docs/api.md, and linking to those from llms.txt. That part is more work, and for a blog it's optional.

llms.txt vs robots.txt vs sitemap.xml

People mix these up, so here's the difference.

File Format Who it's for What it does Officially used by search engines?
robots.txt Plain text rules All crawlers Allows or blocks fetching by path and bot name Yes, it's an IETF standard (RFC 9309)
sitemap.xml XML Search engine crawlers Lists every URL you want indexed, with dates Yes
llms.txt Markdown AI models and agents Summarises the site and points to the best pages No confirmed use for ranking

robots.txt controls access. If a bot is blocked there, llms.txt does nothing for it. If you're working on AI visibility, sort out robots.txt for AI crawlers first.

Does llms.txt actually help?

Here's what I could verify, as of November 2026.

Google says plainly that you don't need it. Its AI features documentation states that you don't need to create new machine-readable files, AI text files or markup to appear in AI Overviews or AI Mode.

I couldn't find any official statement from OpenAI, Anthropic or Perplexity saying their search crawlers read llms.txt or use it for ranking or citations. Their crawler docs cover robots.txt and don't mention llms.txt.

Where it clearly is used is in developer tools and docs. Many documentation sites publish one. The official MCP docs are a good example (see what is MCP for what MCP is): their pages open with a note telling agents to fetch modelcontextprotocol.io/llms.txt to find the rest of the docs. That's the use case it was designed for: an agent that's already on your site and wants a map.

So my honest take:

  • For docs and developer products, it's worth having. That's the audience it was designed for.
  • For a marketing site or blog, it's cheap to add and harmless, but don't count it as AEO work. Good pages and being mentioned on other sites matter far more. I cover that in AEO vs SEO vs GEO.
  • Don't pay anyone to "optimise your llms.txt for ChatGPT rankings".

How to generate llms.txt at build time in Astro

If your file is handwritten, it goes stale the day you publish a new post. On an Astro site, you can build it from your content collection instead, the same way you'd build an RSS feed.

Astro turns a file like src/pages/llms.txt.ts into a static /llms.txt at build time. Here is a trimmed-down version of the endpoint this site uses. It reuses the same getPosts() and postUrl() helpers the RSS feed uses, so drafts stay out and URLs always match.

1. Create the endpoint

src/pages/llms.txt.ts:

import type { APIRoute } from 'astro';
import { site } from '../config';
import { getPosts, postUrl } from '../lib/posts';

export const GET: APIRoute = async () => {
  const posts = await getPosts();

  const lines = [
    `# ${site.name}`,
    '',
    `> ${site.description}`,
    '',
    '## Posts',
    '',
    ...posts.map(
      (p) => `- [${p.data.title}](${new URL(postUrl(p), site.url)}): ${p.data.description}`,
    ),
    '',
    '## Optional',
    '',
    `- [Services](${new URL('/services', site.url)}): Work with me`,
    `- [RSS feed](${new URL('/rss.xml', site.url)}): Every post, newest first`,
  ];

  return new Response(lines.join('\n'), {
    headers: { 'Content-Type': 'text/plain; charset=utf-8' },
  });
};

site is a small config object that holds the site's name and URL, plus a one-line description. getPosts() returns published posts from the content collection, newest first. If your project doesn't have helpers like these, call getCollection('blog') directly and build the URL from post.id.

2. Build and check it

Run astro build and open dist/llms.txt. You should see your site name as an H1, the description as a blockquote, and one line per post with its title, full URL and description. Every new post shows up on the next deploy without you touching the file.

3. Keep descriptions useful

Your post descriptions become the notes in llms.txt. If they're vague ("Some thoughts on AI"), the file is vague. Write each one to say what the reader gets. This helps your search snippets too, so it isn't wasted effort either way.

See Astro's endpoints guide if you're on a server-rendered setup, where the same file runs per request instead.

Common llms.txt mistakes

A few things to avoid, especially in files copied from online generators:

  1. Listing every URL on the site. That's a sitemap. The point of llms.txt is curation, so pick the pages that explain what you do.
  2. Writing it as marketing copy. A model reading "the world's leading platform" learns nothing. Say what the product does and for whom.
  3. Linking to pages that are blocked in robots.txt or sit behind a login. The AI can't follow those links anyway.
  4. Never updating it. If it's handwritten, put a reminder in your release checklist. If it's generated, check the output after big content changes.

Should you add one?

If it takes you 15 minutes, yes, add it and move on. If someone is selling it as the secret to AI rankings, skip the pitch and spend that time on one great page that answers a question your buyers ask. That's the work that shows up in AI answers today.

Questions people ask

Does llms.txt help with SEO or ChatGPT rankings?

There's no official evidence that it does. No major AI company has said it uses llms.txt to rank or cite sites, and Google's AI features docs say you don't need AI text files to appear in AI Overviews or AI Mode. Add one if it's cheap for you, but don't expect it to move rankings.

What is the difference between llms.txt and robots.txt?

robots.txt tells crawlers what they may and may not fetch. llms.txt is a Markdown summary of your site with links to your most useful pages, meant to help an AI model understand it quickly. One controls access, the other offers a reading list.

Where do I put llms.txt?

At the root of your domain, so it loads at yoursite.com/llms.txt. The proposal also allows it in a subpath like /docs/llms.txt for a docs section.

Who created llms.txt?

Jeremy Howard, co-founder of Answer.AI, proposed it on 3 September 2024 at llmstxt.org. The page has since been updated to a second version based on two years of feedback.

Keep reading