How to Search Inside Files: Find Any Text in Documents, PDFs and Folders (Windows, Mac, Linux)
Everyone has searched for a file by name and found nothing, because the thing you remember is not the file name but something inside it: a phrase in a contract, a figure in a spreadsheet, an address in an old email, a line of code in a project. Knowing how to search inside files turns hours of opening documents one by one into a few seconds. This guide shows you exactly how to search inside files on Windows, Mac, and Linux, in Word, PDF, Excel, and text files, in the cloud, and even in scanned documents and images.
You will learn the built-in tools, such as Windows Search, File Explorer, Spotlight, and Finder, free utilities that are far faster, command-line methods for power users, how to make PDFs and scans searchable with OCR, and how to organize your files so they are easy to find in the future.
Quick answer: how do you search inside files?
- Windows: open File Explorer, go to the folder, and type content:”your phrase” in the search box, after making sure the folder is indexed and “Always search file names and contents” is on for it.
- Mac: press Command+Space for Spotlight, type your phrase, or use Finder search with “Contents” selected.
- Any system: use a free tool such as Everything with content search, DocFetcher, or ripgrep, or a command like grep -ri “phrase” folder.
Why Searching File Contents Is Different From Searching Names
A file name search checks only the title. A content search has to open each file, read its text, and match it. That is slower, and it only works for files the computer can read as text. Plain text, code, Word documents, PDFs with a text layer, spreadsheets, and emails are searchable. Scanned documents and photos of text are not, unless they are processed with OCR (optical character recognition).
To make content searches fast, operating systems build an index, a database of words in your files that updates in the background. A good index is the difference between instant results and a ten-minute wait.
How to Search Inside Files on Windows
Method 1: File Explorer search by content
- Open File Explorer and go to the folder or drive you want to search.
- Click the search box at the top right and type your phrase.
- If you only get file name matches, use the search tools or the search options to enable file contents. Alternatively, type content: before your phrase, for example content:”quarterly invoice”.
- For folders that are not indexed, open the search options and turn on “File contents” for non-indexed locations. It works, but it will be slower.
Method 2: Make sure Windows indexes the right folders
- Open Settings, then Privacy and security (or Search), then Searching Windows.
- Choose between Classic and Enhanced search. Classic indexes your main folders; Enhanced searches the whole PC, which uses more resources.
- Add custom folders under the excluded or indexed folder settings, such as an external drive or a projects folder.
- Check that file types you care about are indexed for their contents. In the classic Indexing Options, use Advanced, then File Types, and choose “Index Properties and File Contents” for the extensions you need.
Windows Search can read Word, Excel, and PowerPoint files and many PDFs, depending on installed filters. Menu names vary by Windows version, so use the search box in Settings if you cannot find an option.
Useful Windows search operators
| Operator | Example | What it does |
|---|---|---|
| content: | content:”annual report” | Searches inside file contents |
| kind: | kind:document budget | Limits to a type of file |
| ext: | ext:pdf invoice | Limits to a file extension |
| datemodified: | datemodified:last week | Filters by date |
| size: | size:>10MB | Filters by file size |
| author: | author:Smith | Searches document authors |
| AND, OR, NOT | tax NOT draft | Combines search terms (use capitals) |
| Quotation marks | “exact phrase” | Matches the phrase exactly |
How to Search Inside Files on Mac
Spotlight
Press Command+Space, type a word or phrase, and Spotlight searches names and contents of indexed files, along with emails, messages, and apps. Press Return to open the top hit or use the arrow keys to preview others. In Spotlight settings, you can control which categories it includes, and the privacy list excludes folders.
Finder search
- Open Finder and click in the search box or press Command+F.
- Type your phrase and choose “Contents” or the option that searches the contents of files rather than just names.
- Use the plus button to add filters such as Kind, Last opened, or Date modified. Save a frequently used search as a Smart Folder.
If Spotlight misses files
If results are missing, the index might be incomplete. Add the folder to the Spotlight indexing, or if search is clearly broken, rebuild the index using the privacy list or a Terminal command from Apple’s support instructions, then let it run. This can take a while, so do it overnight.
How to Search Inside Files on Linux
Linux users have powerful options. Desktop environments include search with content support, but the command line is the fastest. A few staples:
- grep: grep -ri “phrase” /path/to/folder searches every file under a folder for a phrase, ignoring case.
- ripgrep (rg): a very fast, modern alternative that respects ignore files: rg “phrase”.
- find with grep: narrow by type, for example find . -name “*.txt” -exec grep -il “phrase” {} +.
- Tracker, Recoll, or similar: desktop indexers that cover documents and PDFs.
Faster Alternatives to Built-In Search
Built-in tools are fine for light use, but if you search often, a dedicated tool can be dramatically faster and more precise.
| Tool | Platform | Strength |
|---|---|---|
| Everything (voidtools) | Windows | Near-instant file name search; content search is available but slower |
| DocFetcher | Windows, Mac, Linux | Free, open source indexer for documents, PDFs, and archives |
| Recoll | Linux, Windows, Mac | Full-text search with many file format filters |
| ripgrep | All | Very fast command-line text search in code and text files |
| Agent Ransack or FileLocator Lite | Windows | Content search with regular expressions |
| Alfred or Raycast | Mac | Launcher with file and content search extensions |
| Cloud search (Google Drive, OneDrive, Dropbox) | Web | Searches inside documents stored in the cloud |
Always download these tools from the official project site, check the permissions they ask for, and scan installers. If you are not sure whether a tool is safe, read about the risks of untrusted downloads in our guide to decluttering your computer.
Searching Inside Specific File Types
Word documents
In Word, press Ctrl+F (Command+F on Mac) to find text in the open document. To find text across many Word files, use Windows or Mac search, or the advanced find in the Open dialog. Word’s Navigation pane also shows results as a list of headings and pages.
PDFs
Press Ctrl+F in your PDF viewer for a single file. For a folder of PDFs, Adobe Acrobat has an Advanced Search across multiple PDFs, and free tools like DocFetcher, Recoll, or your operating system’s index can search them too. The PDF must contain real text, not just images of pages.
Excel and spreadsheets
In Excel, Ctrl+F with the Options expanded lets you search within the workbook, look at formulas or values, and match the entire cell. To search across many spreadsheets, rely on the operating system index or a tool like Agent Ransack. Remember that numbers may be formatted, so searching “1,250” can miss “1250”.
Emails
Search your mail client directly. Outlook, Gmail, and Apple Mail all support operators such as from:, subject:, has:attachment, and date ranges. If you want a better inbox before searching, see our guide to Outlook Inbox Zero or what Inbox Zero means.
Code and text files
Editors like VS Code, Sublime Text, and Notepad++ have “Find in files” with regex support, which is the fastest approach for a project. On the command line, use ripgrep or grep.
Zip and compressed files
Many indexers do not look inside archives by default. DocFetcher and similar tools can, or you can extract the archive first. Keep this in mind when you wonder why a phrase you know exists is not found.
Searching Scanned Documents and Images With OCR
A scanned PDF or a photo of a page is just a picture. To search inside it, you need OCR, which converts the picture to text.
- Adobe Acrobat and many scanner apps can run OCR and add a hidden text layer to a PDF.
- Google Drive can extract text from images and scanned PDFs when you open them with Google Docs.
- Microsoft OneNote and Microsoft Lens can recognize text in images.
- Free tools such as Tesseract and OCRmyPDF can batch-process folders, which is useful for large archives.
- Phone features such as Live Text on iPhone and Google Lens let you select and copy text in photos.
After OCR, check results for mistakes in numbers and names, since the engine can misread similar characters. Keep the original scan in case you need it. For more on keeping paperwork findable, read our guides on tax document storage and storing freelance contracts.
Searching Cloud Storage
- Google Drive: the search bar looks inside Google Docs, PDFs, and many other types. Use filters for type, owner, and date.
- OneDrive and SharePoint: search covers Office documents and text. Results depend on indexing.
- Dropbox: full-text search is available on some plans.
- iCloud Drive: use Finder or the Files app search; content search for some file types is limited.
If you use Drive for desktop, see our guide to Drive for desktop to understand how local and cloud search interact. Streamed files may not be searchable by content locally, so use the web search for the best results.
Smart Search Techniques for Better Results
- Use exact phrases in quotation marks when you remember the wording.
- Search for unique words such as names, invoice numbers, or rare terms rather than common ones.
- Combine filters: file type plus date range cuts thousands of hits down to a handful.
- Try variations. Spelling, plural forms, abbreviations, and punctuation matter.
- Use wildcards where supported, such as * to match any characters.
- Search where it is likely to be. Narrowing the folder is faster and cleaner than searching the entire drive.
- Sort by date modified to find the most recent version.
Troubleshooting: Why You Cannot Find the File
| Problem | Likely cause | Fix |
|---|---|---|
| Phrase exists but is not found | Folder not indexed or file type not indexed for contents | Add the folder to the index and enable contents for that file type |
| PDF results missing | PDF is a scan with no text layer | Run OCR on it |
| Search is very slow | Searching a non-indexed location or a huge drive | Index it, or use a dedicated tool like ripgrep or Everything |
| Recent files not showing | Index still catching up | Wait, or rebuild the index |
| External drive not searched | Not indexed by default | Add it to indexed folders, or use a tool that scans on demand |
| Results from old versions | Duplicates and copies | Sort by date; clean up duplicates |
| Cloud files not found | Online-only files are not indexed locally | Use the cloud service search |
| Password-protected files | Content cannot be read | Search by file name or remove protection if appropriate |
Make Files Easier to Find in the Future
Searching is a rescue. Organization is prevention. A few habits mean you rarely need heroic searches:
- Name files consistently. Use dates in a sortable format, a project or client name, and a short description. Our guide to file naming conventions gives templates.
- Keep a simple folder structure, with a few top-level categories rather than dozens of nested folders. See our digital organization guide.
- Add useful properties such as titles, tags, and authors to documents when it is worth it.
- Delete or archive old drafts so you do not search through five versions of the same thing.
- OCR scans when you create them, not years later.
- Regularly declutter. The full process is in our guide to decluttering digital files.
Privacy Considerations
Content search tools can index sensitive documents. Keep these precautions in mind. Exclude folders with passwords, tax returns, or medical files from third-party indexers if you do not need them searchable. Use full-disk encryption on laptops. Check what a search tool uploads, since some cloud-based tools send content to servers. Prefer local, open-source tools for confidential material. And never type passwords or recovery keys into a search box that might be logged.
Search Examples You Can Copy
Here are practical searches that solve everyday problems. Adjust the words to match your own files.
- Find an invoice by number on Windows: type content:”INV-2026-0412″ ext:pdf in File Explorer.
- Find last month’s contract drafts: type kind:document contract datemodified:last month.
- Find every file that mentions a client on Mac: open Finder, press Command+F, type the client’s name, and set the search to Contents, then add a Kind filter for PDFs.
- Find a function in a code project: run rg “calculateTotal” from the project folder.
- Find large files that mention a topic: combine a content search with size:>5MB to see only heavy documents.
- Find a phone number or email address: search for the part that is least likely to change, such as the last four digits, and use a wildcard if your tool allows it.
When to Use Search and When to Browse
Search is best when you remember a word or a detail. Browsing is better when you remember where something lives or roughly when you made it. Mix both: browse to the right folder, then search inside it. This is quicker than searching the whole drive, and the results are cleaner. If you find yourself searching for the same things every week, that is a sign to create a better folder, a shortcut, or a saved search so that the file is one click away.
Key Takeaways
- Content search needs an index to be fast, so add your important folders and file types to the index.
- Windows uses content: and Explorer search, Mac uses Spotlight and Finder, and Linux users can rely on grep and ripgrep.
- Free tools like DocFetcher, Recoll, Everything, and Agent Ransack can be much faster than built-in search.
- Scanned PDFs and images need OCR before they can be searched.
- Good file names, simple folders, and regular cleanup prevent most searches from being needed at all.
Spend fifteen minutes now to check your index settings, install one good search tool, and run OCR on your important scans. The next time you need that one phrase buried in a file from three years ago, you will find it in seconds rather than losing an afternoon to opening folders.
Frequently Asked Questions
How do I search for text inside files on Windows?
Open File Explorer, go to the folder, and type content: followed by your phrase in quotation marks. Make sure the folder is indexed and that file contents are included for the file type, or enable searching file contents for non-indexed locations.
How do I search inside files on a Mac?
Use Spotlight with Command+Space and type your phrase, or use Finder search with the Contents option selected. Add filters such as Kind or Date modified, and save frequent searches as Smart Folders.
How can I search inside PDF files?
Use Ctrl+F in a PDF viewer for one file. For many PDFs, use Acrobat Advanced Search, your operating system index, or a tool like DocFetcher. Scanned PDFs must be run through OCR first.
What is the fastest way to search file contents?
For code and text, ripgrep is extremely fast. For documents, an indexed tool like DocFetcher or Recoll works well. On Windows, Everything is excellent for names, and the built-in index is fine when properly configured.
Why is Windows Search not finding text inside my files?
The folder may not be indexed, the file type may be set to index properties only, or the index may be incomplete. Add the folder, enable Index Properties and File Contents for the file type, and rebuild the index if needed.
How do I search text inside images or scanned documents?
Use OCR to convert the images to text. Adobe Acrobat, Google Drive, OneNote, Tesseract, OCRmyPDF, and phone features like Live Text can all do this.
Can I search inside zip files?
Many built-in tools do not look inside archives. Use a tool such as DocFetcher that supports archives, or extract the archive and search the extracted folder.
How can I avoid losing files in the future?
Use consistent file names with dates and project names, keep a simple folder structure, delete old drafts, run OCR on scans, and declutter regularly so that search results stay clean.
