Back to All Articles

What is Robots.txt File & How to Create it? Sample & Examples

If you want search engines to crawl your website correctly, the robots txt file becomes one of the first things you must set up. We use the robots txt file in SEO to tell Google which pages you want them to access and which ones they should avoid. 

If you have a website, then you need to know that every unnecessary crawl wastes time and crawl budget. That’s exactly where robots.txt helps. 

It controls what search engines can explore, protects private sections like admin folders, and ensures Google reads your site efficiently. A simple text file can completely change how your site appears in search results.

What is Robots.txt File?

A robots.txt file is a plain text file placed in your website’s root folder. It guides search engine bots on which pages they can crawl and which they must ignore. From an SEO point of view, it helps you manage crawl budget, prevent indexing of unwanted URLs, and keep private or duplicate sections out of search results. 

Robots.txt is not a security tool. It only offers instructions to bots. But when you use it correctly, you give search engines a clean path to follow, improving your website’s technical SEO, crawl efficiency, and overall online visibility.

Robots.txt File Sample

This is a sample robots txt file:

User-agent: *
Disallow: /admin/
Allow: /

Sitemap: https://growthnestmedia.site/sitemap.xml

These are the components of robots txt file with meaning:

ComponentDescription
User-agentDefines which bot the rule applies to (e.g., Googlebot, Bingbot, all bots using *).
DisallowTells bots which pages or directories they must not crawl.
AllowSpecifies exceptions inside a disallowed section that bots can still crawl.
SitemapProvides the link to the XML sitemap for better crawling and indexing.
Wildcard (*)Used to target multiple URLs or patterns.
$ SymbolMeans “end of URL” — useful for blocking specific file types.

Recommended Professional Certificates