Deleting a file in Windows doesn't erase its contents. The space is simply marked as free, and until something else is written there, recovery tools can often read it back. If you're about to sell or pass on a PC, or you just want old files to stay gone, there are two free Microsoft tools that overwrite that leftover data: SDelete from Sysinternals and the built-in cipher /w command. Both are run from the command line, but they're not interchangeable. This comparison is based on Microsoft's documentation as of 29 November 2026.
The short version
| SDelete | cipher /w |
|---|
Where it comes from | Free Sysinternals download (v2.06 at the time of writing) | Built into Windows |
Deletes specific files securely | Yes | No |
Wipes free space on a volume | Yes (-c) | Yes (/w:) |
Zeroes free space | Yes (-z) | No dedicated option |
Number of passes | Set with -p (default 1) | Not configurable |
Supported Windows | Windows 10 and later, Windows Server 2012 and later | Windows' own command |
What cipher /w does
cipher is mainly a tool for Windows' Encrypting File System (EFS): Microsoft describes it as a command that displays or alters the encryption of folders and files on NTFS volumes. Tucked into its options is /w, which Microsoft says removes data from available unused disk space on the entire volume.
You run it with a folder path, for example:
cipher /w:D:\
The folder can be anywhere on the volume, because the whole volume's free space gets wiped. Microsoft notes that if the path is a mount point or points to a folder on another volume, the data on that other volume is removed instead, so double-check the path before you press Enter. When you use /w, all other cipher parameters are ignored.
The appeal is that it's already on every Windows PC. You don't need to download anything, which makes it handy on a work machine or someone else's PC. The trade-off is control: there's no option to delete a particular file securely, no way to choose the number of passes and no zero-only mode.
What SDelete does
SDelete (Secure Delete) is a Sysinternals utility written by Mark Russinovich. Microsoft's page says you can use it both to securely delete existing files and to securely erase any file data left in the unallocated parts of a disk, including files you've already deleted or encrypted.
The main forms of the command are:
sdelete [-p passes] [-r] [-s] [-q] [-f] <file or directory> to securely delete files or folders. -s recurses into subfolders and -r removes the read-only attribute.
sdelete [-p passes] [-q] [-z|-c] <drive letter> to clean (-c) or zero (-z) free space on a drive, for example sdelete -c D:. Include the colon.
The same options also accept a physical disk number, but Microsoft notes that disks must not have any volumes on them to be cleaned that way.
-p sets the number of overwrite passes (the default is one). -z writes zeros, which Microsoft says is good for virtual disk optimisation, for example before compacting a virtual machine's disk file. SDelete also accepts wildcards in file and folder names.
Two details from Microsoft's documentation are worth knowing. First, SDelete securely deletes file data, but not file names that sit in free disk space. When you delete a file with SDelete, it renames the file 26 times to overwrite the name. Second, it handles NTFS compressed, encrypted and sparse files properly. NTFS writes new data for those files to new clusters, so simply overwriting the file wouldn't remove the old contents. SDelete uses the defragmentation API to find the exact clusters and overwrite them directly.
How they wipe free space
Both tools wipe free space by working with the file system rather than around it. Microsoft explains that SDelete doesn't overwrite free clusters directly, because that could collide with Windows writing new data at the same moment and corrupt files or file system structures. Instead it creates the largest file it can, overwrites it, then grabs any space that's left with a second file. On NTFS it also fills the free records in the Master File Table, where very small files can live, with files that it then overwrites.
Microsoft's cipher page doesn't describe how /w works internally, but for SDelete the practical upshot is that the drive temporarily fills right up, and it's sensible to treat cipher /w the same way. Close other apps, don't run a wipe on a drive that's busy recording or downloading, and expect it to take a while on a large, mostly empty drive. If you're short of space on C: afterwards, see how to free up disk space in Windows 11.
The big caveat: SSDs
Both tools were designed around how hard drives work, and neither Microsoft page discusses SSDs. Micron, which makes SSDs, says that overwriting data with an all-zero pattern is a perfectly legitimate method for a hard drive but is not an effective method for an SSD; the proper way to remove data from NAND flash is a block erase on the drive itself. In other words, free-space wiping from Windows isn't a reliable way to sanitise an SSD.
If you're selling or disposing of an SSD, use the drive maker's secure erase feature instead. Our guide to how to securely erase an SSD covers Samsung Magician, Crucial Storage Executive and the options built into Windows. For a hard drive, or a USB stick or memory card you're reusing yourself, SDelete or cipher /w is reasonable. Check the drive's health first with our guide to checking SSD and drive health if it's been acting up.
For files that need to stay private while you're still using the drive, encryption is a better approach than wiping after the fact. See VeraCrypt vs BitLocker.
Which should you use?
Choose cipher /w if you just want to clear free space on a hard drive or volume, you can't or don't want to download anything, and you don't need to target individual files.
Choose SDelete if you want to securely delete particular files or folders, need to choose the number of passes, or want to zero free space before compacting a virtual disk. It's part of the wider Sysinternals suite; see our pick of the best Sysinternals tools.
Choose neither if the goal is wiping a whole SSD before selling it. Use the manufacturer's secure erase instead, or reset Windows and clean the drive as described in our guide.