How to defrag registry in Windows 10?

What is Windows Registry?

Have you ever experienced your PC running slower than usual, after some time?

This is because of fragmentation on the registry. Most computer users do not know what a registry is. The Windows Registry stores settings for most of the applications and user preferences on a personal computer that runs the Microsoft Windows operating system. It contains information and settings for all hardware, software, users, and preferences. While normally necessary for operation, problems with the registry are responsible for an estimated 85% of all crashes in Microsoft Windows systems. Defragmentation of the registry improves application responsiveness by reducing disk head movement during the reading of this database file – it does so by reorganizing portions of the registry to store related items closer together or eliminated gaps between items where they are stored at different physical locations on disk.

Defragmentation of the registry is necessary to maintain its performance, however, the process itself is not without risk – incorrectly executed defragging can delete or overwrite keys and values required for the operation of application programs. As a consequence, Microsoft recommends against running third-party registry cleaners or defragmenters unless they are known to do so safely. It also warns against attempting manual defragging as most computer users are unaware of how the registry works internally and are prone to making serious mistakes that damage Windows. System Restore feature in Windows offers similar functionality without requiring any changes to the registry. Therefore it’s recommended you use this instead whenever possible if restoring an earlier version of the system becomes necessary due to corruption of your operating system files by any of the various malware sometimes discussed on various forums.

While it is beneficial to defrag your registry – it is quite complicated and a bit tricky. Please note, while it may be possible to edit the registry yourself – bear in mind doing so incorrectly could render your system unusable (bricked). If unsure about making registry edits please do not proceed. It could cause severe damage to your PC hence requiring repairs.

Rather, let’s see how to defrag the data on your hard drive

Windows 8, Windows 7, Windows Vista®, and Windows 10 have a new Disk Defragmenter program that runs automatically on a regular basis. If no one needs to perform a manual defrag, you may simply leave it alone; it will run automatically!

Steps to run the Disk Defragmenter tool manually

On Windows 8, Windows 7, or Windows Vista:

1. Click Start and type Disk Defragmenter in the search field.

2. Now click on “Disk Defragmenter” from the list of results.

3. Once open, select a drive by clicking on it and choose Analyze disk from the top toolbar

4. Not that this step will take a few minutes as the program will now scan your hard drive for fragmented files. Now you can view details about what is being done with this app

5. Once completed, click Defragment disk from the top toolbar to start running a defrag on your drive.

Here’s how to keep the Disk defragmenting process as a task scheduler

1. Within the start menu, simply type “cmd” into the search bar and hit enter

2. Now that the command line is open, you’ll need to determine which disk number represents your hard drive by typing in this command followed by Enter, replacing C with the appropriate letter if yours is not C:\>wmic logicaldisk where name=”C:” get Name Volume

3. This will show a list of drives currently attached to your machine

4. This step is done for informational purposes only as it is not necessary but can be helpful when running multiple commands at once. To do click File >> New >> Text document, and open it up in notepad.

5. Once there type ” tasklist /FI “path==C:\Windows\System32” >> defrag.txt (if your drive letter is C:, you can simply type “tasklist /FI “path==C:\Windows\System32″ >defrag2.txt”) This will give you a list of applications running on your computer along with their process ID’s which you’ll need when entering the next step in the command line

6. Now to set up the scheduled task create another text file, this time rename it to taskscheduler_10_basic.xml with .xml at the end being replaced with .TXT if you are using Sheer or Notepad++)

The defrag options will allow you to choose how often the program runs, as well as whether to run defrag automatically when your computer starts up, or not at all. I would suggest that unless you have a small hard drive that isn’t used much then it is okay to have automatic defrag running on startup. However, if you have a very large hard drive and many programs installed on startup, this might slow down your computer so keeping it turned off during start-up might be best for those users.  This step is entirely up to personal preference!

That being said, the Disk Defragmenter application is not perfect. It might miss certain files that can cause it to become fragmented or to not defrag at all. This article will cover how to defrag your hard drives quickly and manually using a third-party app. If you are on Windows 7 Pro/Ultimate or Windows 8/8.1 Pro/Enterprise, I highly recommend Diskeeper Home for PC for this job. If you are on Windows 8 or 10 Home, an alternative product called Auslogics Disk Defrag Free works well too!

Do you need to defrag your SSD?

The question everyone really wants to know is: can I defrag a solid-state drive? The answer is a little more difficult. If you have an SSD, the Disk Defragmenter application in Windows will tell you that it’s not recommended to defrag a solid-state drive because “defragmentation is not necessary for an SSD”. This has been true for all previous versions of Windows since XP, but Windows 7 and 8 added a new feature called Optimize Drives. In short, its job is to attempt to optimize your hard drives by doing what defragging does- moving files around so they are contiguous. So if this option exists in the OS, why even bother defragging your SSD at all?

There are a lot of miscellaneous files on your drive that the OS needs to have easy access to at any time. This means they need to be laid out linearly and thus fragmented- a very slow process for SSDs. While many people will argue that solid-state drives already operate in a fast linear fashion, defragging can still help with performance under certain circumstances. The keyword here is “can”. In most cases, there probably won’t be much of an effect if any at all from doing this on an SSD because Windows takes care of things automatically behind the scenes.

It’s possible for an SSD to get slower from defragging, though- mostly when you start moving system files and other crucial things because Windows won’t be able to do it automatically anymore. – so do not attempt unless you are sure!

So if it’s not defrag, what keeps up the performance of SSDs?


TRIM is a command which was introduced with Windows 7, and it tells the SSDs what areas of the drive are no longer in use. When you delete a file from an SSD, Windows doesn’t actually free up those blocks to be used again- instead, any remaining data that has been overwritten is now considered invalid or broken. TRIM tells the SSD that those blocks can be reused for whatever they feel like as opposed to having to overwrite whatever new data is being written as well as freeing up space before using it.


What’s interesting about this process, however, is how often it happens under normal circumstances. Most modern operating systems and drives should already take care of TRIM behind the scenes so there’s nothing different between defragmentation and TRIM. However, if you are using an older drive or one that the TRIM function hasn’t been enabled for then it could be beneficial to run a defrag on the SSD once in a while to free up space that might have accumulated garbage data.

SO, the first thing we want to do is make sure your operating system has a system file like TRIM enabled for SSDs . TRIM helps the OS know which areas of the drive are no longer in use and can be wiped, speeding up performance as a result.

For those who don’t have an SSD but still want faster computer performance, you should check out our article on how to speed up your laptop by increasing its RAM.

I am a computer engineer holding a bachelor's degree in Computer Science, complemented by a Master's in Business Administration from University of Strathclyde, Scotland. I currently work as a Senior IT Consultant in Melbourne, Australia. With over 15 years of...