How to wipe a USB stick, hard drive or SSD before you sell it or give it away

Deleting the files and doing a quick format feels like enough. It isn't: a quick format only throws away the index, and free recovery tools can often bring most of the files back.

Why a quick format isn't a wipe

A file system keeps a list of where each file lives. A quick format writes a fresh, empty list and leaves the old data where it was, marked as free space. Until something overwrites it, recovery tools can read it straight off the drive. Deleting files works the same way. That's handy when you delete something by mistake, and bad news when you're handing the drive to a stranger.

Pick the method by drive type

DriveGood enoughBest
Spinning hard drive (HDD)Full format (untick Quick format), which overwrites every sector with zerosSame: one pass is enough on modern drives. Multiple passes are a myth from very old drives.
Internal SSD (SATA or NVMe)Encrypt the whole drive (BitLocker or FileVault), then reset or eraseThe drive's own secure erase or sanitize command, from the maker's tool or the BIOS
USB stick or SD cardOverwrite the whole thing once (full format or clean all)Encrypt first (BitLocker To Go or APFS encrypted), then full format
External SSDEncrypt, then full formatThe maker's secure erase tool if it has one
Phone or tabletBuilt-in factory reset (modern phones are encrypted, so a reset makes old data unreadable)Same, after signing out of the phone's account so it isn't locked to you

Why SSDs and sticks are different

Flash drives move data around to spread wear, and keep spare memory you can't see. When you overwrite a file, the new data often lands somewhere else and the old copy stays in a cell the drive has set aside. So overwriting from the computer can't promise to hit everything. Secure erase works inside the drive and resets every cell, including the hidden ones. Encryption works because whatever the drive keeps is scrambled, and the key goes when you erase.

Windows

Mac

Linux

Check the device name with lsblk first: writing to the wrong one erases it. For a hard drive or stick, sudo dd if=/dev/zero of=/dev/sdX bs=4M status=progress overwrites every byte. For an SSD, sudo blkdiscard -s /dev/sdX or sudo nvme format /dev/nvme0n1 --ses=1 asks the drive to erase itself (support varies by drive). shred on single files isn't reliable on SSDs or journaling file systems.

Check it worked

Plug the wiped drive in and run a free recovery tool on it (PhotoRec, for example). If it finds nothing but empty space, nobody else will either.

When to just destroy it

A drive that clicks, won't power up or won't erase can't be wiped from software. If it held anything sensitive, keep it, or physically destroy the platters or memory chips (drill through the platters or the chips) rather than passing it on.

Related

Upgrading? Clone to the SSD first · Stick is write-protected and won't wipe · Check a drive's health first · New SSD not showing up in Windows · External hard drive clicking or beeping · Which format for a USB stick · Interactive: where do deleted files go? (Wirebook)

Questions

Does formatting a drive delete everything?

A quick format doesn't: it only writes a new empty file list, and recovery tools can often get the old files back. A full format (Quick Format unticked) overwrites the whole drive with zeros.

How many passes do I need to wipe a hard drive?

One. A single pass of zeros defeats normal recovery on modern hard drives. The idea that you need many passes comes from drives decades old.

How do I securely wipe an SSD?

Use the drive's built-in secure erase from the maker's tool or the BIOS, or the Mac's Erase All Content and Settings. Encrypting the whole drive first and then erasing it also works.

Is a USB stick safe after a full format?

A full format overwrites what the computer can reach, which stops ordinary recovery tools. For sensitive data, encrypt the stick first and then format it, so anything left in hidden spare memory is unreadable.

How do I wipe a laptop before selling it?

Windows: Reset this PC, Remove everything, Clean the drive. Mac: Erase All Content and Settings. Sign out of your accounts first so the buyer isn't locked out.

Published .

Try it

Related guides

Newest guides