What Windows does not do
File Explorer can sort by size and search by name, which finds copies called report (1).pdf. It cannot compare contents, so a renamed copy is invisible to it. Storage Sense (Settings → System → Storage) clears temporary files, empties the recycle bin, and can remove downloads you have not opened, but it never compares two files against each other. There is no hidden dedupe feature to enable.
The PowerShell method
Open the Start menu, type PowerShell, and open it. Point this at one folder tree, not at your whole drive:
$root = "C:\Users\you\Documents"
Get-ChildItem -Path $root -Recurse -File |
Group-Object Length |
Where-Object { $_.Count -gt 1 } |
ForEach-Object { $_.Group } |
Get-FileHash -Algorithm SHA256 |
Group-Object Hash |
Where-Object { $_.Count -gt 1 } |
ForEach-Object { $_.Group.Path } |
Out-File "$HOME\Desktop\duplicates.txt"
The first Group-Object Length is the part that makes this usable. Hashing reads every byte of a file, so hashing everything is slow; two files cannot be identical unless they are the same size, so grouping by size first means you only hash the small minority that could possibly match. The result is a text file on your desktop listing the full path of every file in a duplicate group.
Deleting without regret
Remove-Item does not use the Recycle Bin. It deletes. So do not pipe the command above straight into it. Open duplicates.txt, decide which copy in each group you are keeping, and move the rest into a quarantine folder for a week before removing them. Skip anything inside C:\Windows, Program Files, or an application's own folder: identical files there are normal, and deleting them breaks software.
One Windows-specific source of duplicates worth checking: OneDrive creates a second copy with the machine name appended when the same file is edited in two places and cannot merge the change. Searching your OneDrive folder for your PC's name usually turns up a small pile of these.
If you would rather have a GUI
Third-party finders do this with previews and better selection tools. The thing to be careful about is the download, not the software: free duplicate finders are a favourite vehicle for bundled adware, and the bundling usually comes from download-portal wrappers rather than the developer. Download from the project's own site, decline the extra offers in any installer, and be sceptical of tools that scan for free but ask for payment before they will delete anything. Open-source options such as dupeGuru and Czkawka avoid both problems, run on Windows, and match by content rather than name.
Cleaning duplicate rows rather than files? That is a different job, and one a browser can do locally: see the Excel tool or the CSV tool. On a Mac instead? The Mac duplicate files guide covers the equivalent options there.
FAQ
Frequently asked questions
Does Windows 11 have a built-in duplicate file finder?
No. Neither Windows 10 nor Windows 11 ships one. Storage Sense clears temporary files, downloads you have not opened, and the recycle bin, but it never compares files against each other.
How do I find duplicate files with PowerShell?
Hash the files and group by hash: Get-ChildItem -Recurse -File, pipe to Get-FileHash, then Group-Object Hash and keep groups with a count above 1. Files in the same group are byte-for-byte identical regardless of their names.
Is the PowerShell method slow on large folders?
Hashing reads every byte of every file, so yes on a big tree. Group by Length first and hash only the files that share a size with another file. Nothing can be a duplicate without matching in size, so this skips most of the work.
Are free duplicate file finders safe?
Some are, many are not. The common problem is bundled adware in installers from download portals rather than the project's own site. Prefer open-source options, download from the official page, and be wary of scanners that show results but demand payment to delete anything.
Does Remove-Item send files to the Recycle Bin?
No. Remove-Item deletes permanently, so a mistake in a duplicate-cleanup script is not recoverable from the bin. Write the list to a file, review it, and move the copies to a quarantine folder before deleting anything.
Last updated