An illustration of a mechanical hard disk drive disintegrating.
Daniel Krason/Shutterstock.com

Windows has built-in tools that will let you write zeros to a drive, securely erasing its contents. This ensures deleted files on the drive can’t be recovered. Whether you want to wipe an internal drive or an external USB drive, here’s how to do it.

What You Need to Know

It’s often possible to recover deleted files from a drive. Whether this is possible depends on a number of factors.

If the drive is a traditional magnetic drive with a spinning platter, deleted files are simply “marked” as deleted and will be overwritten in the future, making recovery of deleted data easy. This should not be the case on modern solid-state drives, as they should use TRIM by default, ensuring that deleted files are deleted immediately. (This helps with speed.)

However, it’s not so simple as mechanical vs. solid-state storage: External storage devices like USB flash drives don’t support TRIM, which means that deleted files could be recovered from a USB flash drive.

To prevent this from happening, you can “wipe” a drive. This is actually a pretty simple process: Windows will write zeroes or other junk data to every sector of the drive, forcibly overwriting any data already there with junk data. This is a particularly important step to take when you’re selling or otherwise disposing of a computer, drive, or USB stick that had sensitive private data on it.

Advertisement

By the way, if a drive is encrypted, this provides a lot of additional protection. Assuming an attacker can’t get your encryption key, they wouldn’t be able to recover deleted files from a drive—they wouldn’t even be able to access files that aren’t yet deleted.

Option 1: Wipe Any Entire Drive

To write zeros over the contents of any drive, all you have to do is perform a full format of the drive. Before you do this, bear in mind that this will completely erase all files on the drive. Also, you can’t perform a full format of your Windows system drive while you’re running Windows from it.

This method is ideal for internal drives that don’t have your operating system installed, USB flash drives, other external storage devices, and any entire partitions you want to erase.

To get started, open File Explorer and locate the drive you want to wipe. Right-click it and select “Format.”

Right-click a disk and select "Format."

Uncheck “Quick Format” under Format Options. This will ensure Windows 10 or Windows 11 performs a full format instead. According to Microsoft’s documentation, ever since Windows Vista, Windows always writes zeros to the whole disk when performing a full format.

You can change any other formatting options you like here; just ensure “Quick Format” isn’t checked. (If you’re not sure what to choose, just leave the options here on their default settings.)

Advertisement

When you’re ready, click “Start” to format the drive. The process may take some time depending on the size and speed of the disk.

Warning: The format process will erase everything on the drive. Be sure you have a backup of any important files before continuing.

Uncheck "Quick Format" and click "Start."

Option 2: Wipe Only Free Space

If you’ve deleted some files from a mechanical hard drive or an external storage device, you might want to wipe only the free space, overwriting it with zeros. This will ensure those deleted files can’t easily be recovered without wiping the entire drive.

Windows 10 and Windows 11 have a way to do this, but you’ll have to visit the command line. The cypher command built into Windows has an option that will wipe a drive’s free space, overwriting it with data. The command will actually run three passes, first writing with zeros, then another type of data, then random data. (However, just one pass should be enough.)

To get started, launch a command-line environment like the Command Prompt or Windows Terminal with administrator permissions. On either Windows 10 or Windows 11, you can right-click the Start button or press Windows+X and click either “Windows PowerShell (Admin)”, “Command Prompt (Admin)”, “Windows Terminal (Admin)”. Choose whichever appears in the menu—any will work.

Right-click Start and select "Windows PowerShell (Admin).")

Run the following command, replacing X with the drive letter of the drive you want to wipe free space for:

cipher /w:X:\

For example, if you want to wipe free space on your D: drive, you’d run the following:

cipher /w:D:\
Advertisement

The command will show its progress at the command line. Wait for it to finish—depending on the speed of your drive and the amount of free space to be overwritten, it may take some time.

Run the cipher /w command.

Option 3: Wipe Your Windows System Drive

If you want to wipe your entire Windows operating system drive, there’s an easy way to do it. This option is built into the Reset This PC feature on Windows 10 and Windows 11, although it isn’t enabled by default.

While Windows is restoring itself to factory default settings—in other words, reinstalling Windows—you can have it wipe your system drive. You should use this option to protect your private data when you’re selling your PC or giving it to someone else.

To do this on Windows 10, head to Settings > Update & Security > Recovery. Click “Get Started” under Reset This PC. (You can press Windows+i to quickly open the Settings app.)

Click "Get Started."

On Windows 11, head to Settings > System > Recovery. Click the “Reset PC” button under Recovery Options.

Click "Reset PC."

Select “Remove Everything” to have Windows remove all your files during the Reset process.

Click "Remove Everything."

Advertisement

Select “Local Reinstall” or “Cloud Download,” either will work for this process. If you’re not sure which to pick, we recommend selecting “Local Reinstall” to avoid the big download.

Cloud Download” is useful if your local Windows operating system files are corrupted and the Reset This PC process won’t work otherwise. Also, believe it or not, Cloud Download can be faster than Local Reinstall as Windows just has to download installation files rather than reassembling them from the files on your computer’s hard drive—it depends on the speed of your internet connection.

Select "Cloud Download" or "Local Reinstall."

Under Additional Settings, select “Change Settings.”

Click or tap "Change Settings."

Clean the switch under “Clean data?” to set it to “Yes.” With this option enabled, Windows will “clean the drive” and make it much harder (theoretically, practically impossible) to recover your files

Windows warns you that this process may take hours—as always, it depends on the speed and size of the drive in your computer.

You can now click “Confirm” and continue through the process to reset your Windows 10 or Windows 11 PC and wipe your drive during this process.

Warning: This process will erase all the files, applications, and settings on your drive, leaving you with a fresh Windows installation without any of your files. Be sure to back up everything important first.

Enable "Clean Data?".

By the way, Windows refers to this process as “cleaning the drive” instead of wiping it. This is different from the traditional meaning of “cleaning” a drive in Windows, which actually refers to removing all of its partition information rather than wiping it.

Profile Photo for Chris Hoffman Chris Hoffman
Chris Hoffman is Editor-in-Chief of How-To Geek. He's written about technology for over a decade and was a PCWorld columnist for two years. Chris has written for The New York Times, been interviewed as a technology expert on TV stations like Miami's NBC 6, and had his work covered by news outlets like the BBC. Since 2011, Chris has written over 2,000 articles that have been read nearly one billion times---and that's just here at How-To Geek.
Read Full Bio ยป

The above article may contain affiliate links, which help support How-To Geek.