These two controls are often confused, but they solve different problems. Robots.txt is about crawl access. Noindex is about whether a page should appear in search results.
A blocked page can still be indexed if search engines learn about it from links, sitemaps, or other references. In that case Google may show the URL with limited information because it knows the page exists but was not allowed to crawl it.
That is why robots.txt is the wrong tool if your real goal is "do not let this page appear in search."
If you are managing crawl budget or bot behavior, start with robots.txt. If you are managing what can rank, use noindex. If content is truly private, use authentication and do not rely on either public directive alone.
If you just need a valid robots.txt file with sitemap lines and custom crawler rules, the generator is the quickest place to start.
Build a Robots.txt File