Technology in terms you understand. Sign up for the Confident Computing newsletter for weekly solutions to make your life easier. Click here and get The Ask Leo! Guide to Staying Safe on the Internet — FREE Edition as my thank you for subscribing!

How Can I Securely Delete Everything Except the Operating System?

How to get as close as you can.

Before giving away a machine or returning a loaner, it's important to remove your personal information from it. That may be both harder and easier than you think.
A concerned young man with large glasses holding a pink eraser beside a laptop. The laptop screen displays the Windows logo and icons of a folder, a document, and a trash can. The background is warm-toned, and there's a cup of pencils on the desk.
(Image: ChatGPT)
Question: I’m about to give away my machine, but I want to leave Windows installed. How can I securely delete everything except the operating system?

You can’t.

Not completely and definitely not securely.

I’ll describe a few steps that will delete a lot — perhaps enough for your concerns — but it depends on how paranoid you are about the various traces that will still be left on a machine you’ve been using for a while. Then I’ll give you my recommendation.

Become a Patron of Ask Leo! and go ad-free!

TL;DR:

Deleting everything but Windows

While you can’t securely delete everything, you can get close.

  • Delete and uninstall data and programs.
  • Remove users.
  • Run a disk-cleaning utility.
  • Delete some system files.
  • Wipe free space.

Alternately, reinstall Windows from scratch, erasing all data as part of the process.

Delete and uninstall as much as you can

The process starts by deleting your data files and uninstalling all the programs you’ve used or added and don’t want to be part of the machine when it’s reused by someone else.

For your data files, that means deleting things from My Documents and wherever else you kept data files.

A good start for programs is to take a look at Add/Remove Programs, Programs and Features in the Control Panel, or the Settings App, and just start uninstalling.

For extra security, you might want to use Revo Uninstaller instead. Revo not only lists more things but also uninstalls more thoroughly. It uses a couple of levels of “aggressiveness” to determine what to remove, and this is one case where it makes sense to be as thorough as possible.

Remove all the users but one

If your machine has more than one user account, remove all except for a single account that has administrator privileges. This should delete a plethora of files and settings associated with each account.

Clean crud

Run the built-in Disk Cleanup Utility, or, better yet, grab a copy of CCleaner (a free download — you do not need to buy support), and let it clean up as much as it can.

The goal here is to remove traces from browser caches, temporary files, and a host of other things. Much of this might be benign, but some may contain things you’d rather not share with your machine’s subsequent owner.

Consider running a registry scan. I’m not a big fan of registry cleaners, but this is a case where they might remove additional information you don’t want left behind, and the cost of failure (an unbootable machine) is relatively low. Take an image backup prior to the cleaning in case you want to recover from that worst-case scenario.

Turn off some system files

Set your virtual memory to zero and delete the paging files. Turn off Hibernation and remove the hibernation file. These are hidden files in the root of your system drive, typically C:\.

Turn off System Restore.

All of these files could contain private information and can be turned back on by the machine’s new owner should they so desire.

Securely erase the empty space

Using a tool like CCleaner’s “Drive Wiper”, securely erase unused space on your hard disk.

Merely deleting files doesn’t overwrite the data, so it could still be recovered. Tools like Drive Wiper overwrite the unused space on your hard drive with random data to remove all traces of what had been stored there before.

That’s about as good as you can get using this approach.

What still might be missed

The problem with this approach is that you don’t know what you might have missed.

Even after all the deleting and cleaning above, there might be system files left showing something about who you are or what you used the machine for. For example, registry settings that contain settings for programs (perhaps even programs no longer installed) could remain.

You just don’t know.

That’s why this is not an approach I recommend.

Nuke it instead

Here’s the approach I recommend: boot from Windows installation media and install Windows from scratch, making sure to erase everything in the process.

Erasing the hard disk completely is the only way to be absolutely sure you haven’t left personal information on the machine before handing it off to someone else.

Do this

If at all possible, I recommend the “Nuke it” approach. That way, you’re certain not to have left anything sensitive behind.

If you found this article helpful, you’ll love Confident Computing! My weekly email newsletter is full of articles that help you solve problems, stay safe (including what needs erasing when), and increase your confidence with technology.

Subscribe now, and I’ll see you there soon.

4 comments on “How Can I Securely Delete Everything Except the Operating System?”

  1. I service senior’s computers. That’s Seniors as in Old People. I take care of your grandmother’s computer. It’s a great business for a retired guy who still likes helping seniors with new technology.

    I often setup and transfer data and programs from the old pc to new. When it comes to “what to do with the old pc” I always suggest removing the drive and keeping it. In a protective way and mark it as to where it came from and date. My thinking is: it’s always a source to connect to and copy the missing pictures from the grand baby’s first birthday or the granddaughter’s wedding. Seniors seldom save files in appropriately designated folders and their jpgs are scattered all over the pc: in desktop, downloads, pictures, documents, 5 year old email folders and other strange places.

    The old computer’s is usually really old, and of little value. My suggestion to them is to make a petunia planter or boat anchor from the pc case. Seems like the intent is always to give it to a grandson but never makes it out of the closet. The grandson generally already has something much better and really doesn’t want grandma’s old pc.

    Reply
    • I’d suggest to them that they get an HDD USB housing and use that drive as a backup. Search the drive for any image and video files and copy them to the new machine and move them to appropriate folders on the older drive. Erase the Windows, Programs, and possibly a few other folders which you know don’t contain any user data to make more space for backups

      Reply
  2. DBAN is nice but I prefer Secure Erase instead since it’s quicker (the drive itself overwrites/blanks all writable areas on the hard drive) and is good enough from what I have read on regular hard drives and in terms of SSD’s, Secure Erase is definitely what you want as DBAN is bad for SSD’s.

    even on SSD from what I understand (someone correct me if I am wrong) when the Secure Erase is issued (like on Samsung 850 EVO etc), it simply changes some sort of internal encryption key within the drive itself so any previous data won’t be recoverable because the encryption key the drive uses to read that data is deleted/changed (this applies for normal use/non-encrypted SSD’s (i.e. how a typical person would be using their SSD)). I think this is why Secure Erase is very fast on a SSD (maybe a couple of seconds or so to complete) since it does not actually overwrite the SSD data like it does with a regular hard drive, but since it changes the encryption key from within the SSD internally it’s like all of the data is overwritten and completely blank. but with a regular hard drive it actually has to overwrite all areas of the hard drive which takes much longer.

    when using Secure Erase I just use the last free version of ‘Parted Magic’ (one can get it from majorgeeks dot com) which is from the year 2013 from a bootable CD-RW etc. it basically requires a unfrozen HDD/SSD to work (they are generally frozen by default upon boot up) which ‘might’ require removing the power to your HDD/SSD while the computer is running after Parted Magic is up and running etc as that’s generally what I have to do to get them in a unfrozen state so that the Secure Erase command is issued on my old computer etc. it gives you a option to try first (like temporarily powers down PC and back on (i.e. sleep mode) to the Parted Magic stuff) before doing this, but it might or might not work. but the key thing here is getting the HDD/SSD into a unfrozen state otherwise the Secure Erase command can’t be issued. here is their general website page on Secure Erase which looks a little different on the older version of Parted Magic from that majorgeeks website but it gets the gist of things across… partedmagic.com/secure-erase/ (NOTE: while that is the official website of Parted Magic, those newer versions are not free but the one listed on majorgeeks website is completely free, but it’s from the year 2013(which is what I use)) ; but from memory, I believe it has a person enter a password thing (like where it says ‘NULL’), I just put ‘temp’ (without the ‘) or whatever you want, just keep it simple and don’t forget it. but if you don’t stop the process once it’s started (which we don’t want to do!) you should be okay. because it does not give any progress percentage etc when I issue a Secure Erase(but does tell you if it’s started the process or not), but it does tell you when it’s done at which point it’s safe to power off the computer and your HDD (or SSD) is completely clean as no data can be recovered from it. but expect it to take quite a while as I think, off the top of my head, it’s over a hour on a 400-500GB hard drive before it completes just give you a rough idea of how long it will take. also, it might ask whether you want to do a standard secure erase or a ‘enhanced’, just stick with standard.

    in fact, after checking… I am actually loading the Parted Magic version from the year 2013 from the Ultimate Boot CD v5.3.9, which is also on that majorgeeks website.

    Reply

Leave a reply:

Before commenting please:

  • Read the article.
  • Comment on the article.
  • No personal information.
  • No spam.

Comments violating those rules will be removed. Comments that don't add value will be removed, including off-topic or content-free comments, or comments that look even a little bit like spam. All comments containing links and certain keywords will be moderated before publication.

I want comments to be valuable for everyone, including those who come later and take the time to read.