Document Key
Windows 10 & 11 Buy license · $29.95
How-to

How to Wipe Free Space in Windows With the cipher /w Command

How to wipe free space in Windows with cipher /w so deleted files cannot be recovered. Step by step, with timing tips and SSD caveats.

Updated 5 minute read The Document Key team

To wipe free space in Windows with cipher, open Command Prompt or Terminal and run cipher /w:C:\, replacing C with the drive you want to clean. The command overwrites every unused part of that drive three times, first with zeros, then with ones, then with random data, so files you deleted earlier cannot be recovered from that space. Your existing files are not touched. It is built into Windows 10 and 11, including Home, and works best on traditional hard drives; on SSDs it is less predictable, for reasons explained below.

This guide covers when to use it, the exact steps, how long it takes, and what it does not do.

Why wipe free space at all?

When you delete a file, Windows marks its space as available but leaves the data where it was. Until new data lands in exactly that spot, a recovery tool can often bring it back. That is useful after an accidental delete, and a problem when the deleted file was a tax return, a contract or an ID scan.

Wiping free space is a clean-up step for files you have already deleted. It is particularly useful:

  • After you encrypt sensitive files and delete the unencrypted originals.
  • After clearing out old client folders or financial records.
  • Before lending or passing a drive to someone else when you do not want to erase it completely.

For files you are deleting from now on, a secure delete tool is more direct. Our guide to securely deleting files in Windows 11 compares the approaches.

How to run cipher /w step by step

  1. Delete the files you want gone and empty the Recycle Bin. Files still in the Recycle Bin are not free space.
  2. Close other programs, especially ones that write a lot to disk, such as downloads, sync tools or video editors.
  3. Plug in a laptop and turn off sleep for the duration, or the process may pause for hours.
  4. Right-click the Start button and choose Terminal (Admin) or Command Prompt (Admin). An administrator window avoids permission problems on system drives.
  5. Type cipher /w:C:\ and press Enter. For a second drive, use its letter, for example cipher /w:D:\.
  6. Leave the window open. Cipher shows progress messages as it writes zeros, then ones, then random numbers.
  7. When the prompt returns, the wipe is complete.

You can point cipher at a folder instead of a drive root, such as cipher /w:D:\Clients, but it still wipes all the free space on the whole drive that folder is on. The folder path is simply a way to say which drive.

What to expect while it runs

  • Disk space warnings. Cipher fills the drive's free space with temporary data, so Windows may briefly warn that the drive is almost full. This is normal and the space is released at the end.
  • A temporary folder. Cipher creates a folder called EFSTMPWP at the root of the drive while it works. If the process is interrupted, that folder may be left behind; it is safe to delete it.
  • Slower performance. The drive is busy for the whole run, so expect the PC to feel sluggish.

How long does it take?

The time depends on the amount of free space and the drive's sustained write speed. Because cipher makes three passes, it writes roughly three times the free space. A simple way to estimate:

  1. Check the free space in File Explorer under This PC.
  2. Multiply it by three.
  3. Divide by the drive's typical write speed.
ExampleData writtenAt this write speedRough time
200 GB free on a hard drive600 GB100 MB per secondAbout 1 hour 40 minutes
1 TB free on a hard drive3 TB100 MB per secondAbout 8 to 9 hours
16 GB free on a slow USB stick48 GB10 MB per secondAbout 80 minutes

Real runs are often slower than the arithmetic suggests, because write speeds drop as a hard drive fills toward its inner tracks and because other activity competes for the disk. If you need it done quickly, run it only on the drive that held the sensitive files, and start it before you leave the PC for the night.

Cipher /w on SSDs

Solid state drives work differently. When you delete a file, Windows sends a TRIM command telling the SSD which blocks are no longer used, and the drive clears them in the background. That usually makes deleted data hard to recover even without a wipe. At the same time, SSDs spread writes across their memory and keep spare capacity hidden from Windows, so cipher cannot guarantee it overwrote every old block.

The result: on an SSD, cipher /w adds some extra assurance but is not a guarantee, and it causes a lot of extra writes. Most people are better served by keeping TRIM on and encrypting sensitive files from the start. Our article on whether secure delete works on an SSD covers this in more detail.

To check that TRIM is enabled, run fsutil behavior query DisableDeleteNotify in an administrator Command Prompt. A result of 0 means TRIM is on.

What cipher /w does not do

  • It does not delete or overwrite any file that still exists, including copies you forgot about in Downloads or cloud folders.
  • It does not remove files from cloud storage, backups or other drives. Run it on each drive separately.
  • It does not encrypt anything, despite the command's name. The /w switch only wipes. For encryption with cipher, see our guide to the cipher command for encrypting files.
  • It is not a substitute for a full drive erase before selling or recycling a PC. Use Settings → System → Recovery → Reset this PC with Remove everything and Clean data turned on for that.

A better routine: encrypt, then delete the originals securely

Wiping free space is a catch-up step. The cleaner approach is to avoid leaving readable copies in the first place. When you encrypt a file with Document Key, it can securely overwrite the unencrypted original straight away, so there is nothing left to wipe later. Document Key's watched folders can also encrypt new scans and downloads as they arrive, so they never sit around in readable form. Combine that with an occasional cipher /w on hard drives to clear older remains, and keep sensitive files encrypted at all times, so anything left behind is unreadable anyway.

Frequently asked questions

What does cipher /w do?

It overwrites the free space on a volume three times, with zeros, then ones, then random data, so previously deleted files cannot be recovered from that space.

Does cipher /w delete my existing files?

No. It only overwrites space that is not in use. Your current files are not touched.

How long does cipher /w take?

It depends on how much free space the drive has and its speed. On a large hard drive it can take several hours.

Get three guides like this every month, plus software update notices.Subscribe →