How to Use the Windows 11 Cipher Command to Securely Wipe Free Space

When you sell an old laptop or repurpose a hard drive, simply dragging your files to the Recycle Bin and clicking “Empty” does not actually destroy the data. Windows simply deletes the index pointing to those files, marking the space as “available” for future use. Until that space is physically overwritten with new data, anyone with basic recovery software can easily resurrect your deleted tax returns or sensitive documents.

To permanently destroy this invisible data, you must perform a secure wipe. While there are many third-party tools for this, Windows 11 includes a powerful, built-in command line utility designed for this exact purpose: cipher.

In this guide, you will learn how to use the cipher command to permanently overwrite the free space on your hard drive, ensuring deleted files are gone forever.

How the Cipher Command Works

The cipher utility was originally designed to manage file encryption on NTFS drives. However, Microsoft included a special flag (/w, which stands for wipe) to sanitize storage space.

When you run the command against a specific drive (like your C:\ drive), it does not touch any of your existing, active files or operating system data. It only targets the “empty” space on the drive.

It overwrites this empty space using a rigorous three-pass method:

  1. Pass 1: It fills all the free space with the number 0x00 (all zeros).
  2. Pass 2: It overwrites everything again with the number 0xFF (all ones).
  3. Pass 3: It overwrites everything a final time with random numbers.

After these three passes, any residual data left behind from previously deleted files is completely destroyed.

Step 1: Close All Applications

Because cipher is attempting to write data to every single available sector on your hard drive, you must close all running applications (browsers, Word documents, games) before starting. If an active application generates a temporary file while cipher is running, it could interrupt the process or leave a tiny sector un-wiped.

Step 2: Run the Command in PowerShell

You must execute this command with administrative privileges.

  1. Click the Start button.
  2. Type PowerShell.
  3. Right-click on the “Windows PowerShell” result and select Run as administrator.
  4. When the blue terminal window opens, type the following command, specifying the drive letter you want to wipe (in this case, the main C: drive):
cipher /w:C:\

Press Enter.

Step 3: Wait for the Process to Complete

The terminal will display a message stating: “To remove as much data as possible, please close all other applications while running CIPHER /W.”

It will then begin the first pass (writing 0x00). Depending on the size of your hard drive, its speed (SSD vs HDD), and how much free space is available, this process can take a very long time—often several hours. The terminal will display dots as it progresses through the three passes.

Do not close the terminal window or turn off your PC until the command completely finishes and returns you to the standard PowerShell prompt.

By regularly running the cipher command, you ensure that your deleted files remain deleted, securing your privacy without requiring expensive third-party software.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.