Wipe your drives securely with a hidden Windows 7 tool

Mike Halsey MVP
Jun 21, 2010
Updated • Jun 10, 2014
Tutorials, Windows 7

It's always a worry when you get rid of a PC or hard drive that all sorts of personal data could be sitting on it waiting to be stolen.  This is even more important when it comes to business computers.

There have always been a huge variety of hard disk wiping packages available from third-parties, but did you know that Windows 7 has it's own free in-built tool for securely erasing, not just whole hard disks, but specific folders as well?

The cipher.exe tool has been around for years now and is used for managing the EFS (Encrypted File System) feature that preceeded Bitlocker and was first introduced with Windows 2000.  It's run from the Command Prompt (as an Administrator).

With Windows 7 though Microsoft have added a new switch to the tool, and it's one you should definitely use with care!

The command is simply cipher /w:x:\folder where you would substitute x:\folder for the location you want wiped, for instance your D:\ drive or your C:\Users\Mike Halsey\Music folder.

This will write a series of 0s, 1s and then random characters to every sector of the drive or folder to securely erase the data that's stored there.  Believe me, if you do this casually you're not going to get your data back afterwards.

Microsoft say that this feature is here for clearing empty folders and drives that need to be erased, and it's an excellent way to save money on expensive third-party software.

So the next time you're upgrading your hard disk, don't waste your money, just cipher the thing instead.

To display a list of all parameters run cipher /? on the command line. This displays every parameter and a short description that explains what it is used for.

Update: There are free third party tools available that let you perform the same operations. Eraser is one of the programs that you can use for that purpose. You can have the program erase data in folders, hard drives or free disk space of a drive easily.

Wipe your drives securely with a hidden Windows 7 tool
Article Name
Wipe your drives securely with a hidden Windows 7 tool
How to use the built-in cipher Tool of Windows 7 (and newer versions of the operating system) to delete files and folders on a drive securely.

Previous Post: «
Next Post: «


  1. - said on October 6, 2019 at 5:11 am

    > i need to swipe my data on my laptop

    Do quick format first, then “cipher /w:c”

  2. Dave said on December 18, 2013 at 9:39 pm

    I did use the cipher/w:e\folder. It took quite a long time writing 0x000 then writing 0xFF and then writing Random Numbers, but after it was done the e drive had files on it.

  3. Alison said on April 22, 2013 at 5:58 pm

    i need to swipe my data on my laptop

  4. Jesse said on October 30, 2012 at 5:46 am

    Correction: The correct command is:

    cipher /w:x:\folder

    If you want to watch it work open the folder and it creates a EFSTMPWP folder with a .tmp file that will fill the drive 3 times with 00, FF and random numbers

    Here is an example run on a 4GB flash drive that took approx 1 hour:

    C:\> cipher /w:G:\
    To remove as much data as possible, please close all other applications while
    running CIPHER /W.
    Writing 0x00
    Writing 0xFF
    Writing Random Numbers

  5. Dave Brown said on February 4, 2012 at 5:45 pm

    For my part, I have no use for a tool that will delete all data found on a machine (DBAN/Boon’n’Nuke), so this article has been very helpful. All I want to do is ensure there’s nothing remaining on a drive that used to be my primary but I now have in an external case for my clients to use to send me video files. cipher /w:j:\ was perfect.

    1. Dave Brown said on March 1, 2012 at 1:57 pm

      …and I’m using this technique again on a failing backup drive that I’m returning to the vendor for replacement. Again, don’t want to wipe all drives, just one.

  6. 123456 said on June 22, 2010 at 6:43 pm

    Mike, please do us the favor of NOT writing here any more, before you are able to at least the manuals.
    As was already stated, it’s not important where the drive is mounted if you use /w as _all_ unallocated space gets wiped.
    cipher.exe /w c: will overwrite nothing important, just the empty reported blocks. No allocated blocks will be touched, meaning it does NOT delete anything!

    So the tool will not ‘wipe’ a drive as understood by the masses.

  7. Beecher Bowers said on June 22, 2010 at 2:43 pm

    You’ll need to delete everything on the drive PRIOR to using the /W switch. The switch doesn’t actually delete anything.

    This switch only overwrites “available unused disk space on the entire volume”. If you have contents in the location, they won’t be overwritten, per the /w switch documentation.

    This switch is also available on Windows XP.

  8. Taomyn said on June 21, 2010 at 9:22 am

    Think I’ll stick with Boot’n’Nuke

    1. Anonymous said on June 22, 2010 at 2:51 am

      *nods*, DBAN is a great tool, it can be found here – http://www.dban.org/download (it goes without saying, use with care!)

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.