Features
How to Create an llms.txt File, Step by Step
At a glance
An llms.txt file is a plain text document that tells large language models how to navigate your site.
About the publisher · Editorial standards and corrections
Ask AI about this story

On this page
What an llms.txt file contains
An llms.txt file is a plain text document that tells large language models how to navigate your site. You create it by writing a markdown-style summary of your content, listing key pages with URLs, and saving it to the root of your domain so bots can fetch it easily.
The format is simple. It starts with a title and a short description of the site or project. Below that, you list sections. Each section has a heading and a list of links. The links should point to the most important pages, such as documentation, features, or contact information. The goal is to give the model a map of your site without forcing it to crawl every single page. This helps the model understand the structure and find relevant information faster.
Writing the content
Start by identifying the core value of your site. For a publication like PracandyFlix, the most important pages are the latest articles and the category archives. For a tool, it is the help documentation and the feature overview. Keep the descriptions short. A single sentence per link is usually enough. Avoid marketing fluff. The model needs factual information about what the page contains, not why it is good.
Use standard markdown syntax. Headings use hash symbols. Links use standard markdown link format. You can also include a section for "About" or "Contact" if those pages are important for context. The file should be concise. If a page is not essential for understanding the site, leave it out. The file is not a sitemap for humans. It is a guide for machines. It should help the model answer questions about your site accurately.

Hosting the file
Place the file in the root directory of your web server. If you are using a static site generator, add it to the public folder. If you are using a framework like Next.js, you can serve it as a static file or create a route that returns the text content. The file must be accessible at /llms.txt. This means if your site is at example.com, the file should be at example.com/llms.txt.
For static sites like GamingCap or Invoiceful, which are served directly from disk by Caddy, you simply place the file in the build output directory. Caddy will serve it automatically. For dynamic sites, ensure your server configuration allows the file to be served with the correct content type. The content type should be text/plain. Some servers might default to text/html, which is not ideal but usually works. The file should be small. A few kilobytes is plenty. Large files waste bandwidth and time.
Verifying the setup
Once the file is live, test it by visiting the URL in a browser. You should see the raw text. If you see a 404 error, the file is not in the right place or the server is not configured to serve it. If you see HTML, the server is wrapping the text in tags. This is not a problem for most models, but it is cleaner to serve plain text. You can also use a tool like curl to fetch the file and check the headers. Look for the content type header. It should be text/plain. If it is not, you may need to adjust your server configuration.
Check that the links in the file work. Copy a few URLs and paste them into a browser. If a link is broken, the model will get a 404 error when it tries to fetch that page. This hurts the quality of the answers. Keep the file updated as your site changes. If you add a new important page, add it to the file. If you remove a page, remove it from the file. The file is a living document. It should reflect the current state of your site. Regular maintenance ensures the model always has accurate information.


