No. Robots.txt controls crawling, not indexing. Google says it is not a way to keep a page out of search. Use noindex or a password instead.
Google describes robots.txt as a way to tell crawlers which URLs they can access, mainly to avoid overloading a site. A blocked page can still appear in results if other pages link to it.
For a page that should not show up, add a noindex tag or put it behind a password. Keep robots.txt for crawl control, like filter and search URLs.
Source: Google Search Central, Introduction to robots.txt. Reviewed Sep 23, 2026.