The longer you use your computer, the more likely it is to become slower over time, especially as you pile up more files on your drives. Filling up your hard drive can significantly downgrade performance, and one good way to help address that problem is to optimize or defragment that drive. In this article, we'll show you how to defragment a drive on your Windows 11 PC.
Windows 11: Everything you need to know
Windows 11 is the latest and greatest operating system from Microsoft, and it packs a ton of changes. Here's what you need to know.
What is defragmenting?
Defragmenting means that Windows will search for files split across different parts of the physical drive and put the bits in the same area, making it easier for the computer to read them sequentially. This can make a big difference on a hard disk drive (HDD) as the spinning platters take longer to locate the different parts of a file if they're scattered throughout the drive.
However, you probably won't see many mentions of defragmenting these days. That's because most PCs today come with a solid-state drive (SSD) or eMMC storage, which works very differently in how files are accessed. Accessing different parts of the drive doesn't take significantly longer now, and defragmenting can actually be detrimental to the lifespan of an SSD since it uses up more write cycles, which are limited on this kind of drive. This used to be a bigger problem with earlier SSDs that had particularly short lifespans, but even today, there's no benefit to defragmenting an SSD.
Instead, Windows 11 optimizes SSD drives by doing something called trimming. This marks unused parts of the drive as being ready for use, making it faster to write new data to that segment when needed.
How to defragment and optimize your drive
The easiest way to defragment or optimize your drive is to use the built-in disk optimization tool in Windows 11. This tool automatically defragments or optimizes your drive depending on whether you have an SSD or HDD. It's the best way to do it since it avoids wearing out an SSD with defragmentation.
-
Open the Start menu and type Defragment. The first result should be Defragment and Optimize Drives. Select it.
- Select the drive you want to optimize or defragment.
-
Click Analyze to check if the drive needs optimizing or defragmenting.
-
If it does, click Optimize.
- The process may take a while. If you're defragmenting an external drive, make sure it stays plugged in until the process is done.
How to schedule drive optimization
You can also schedule the optimization to run regularly. The default sets a weekly defragmentation schedule for internal drives on your PC. If you want to change that, follow these steps.
- Open the Defragment and Optimize Drives window again.
-
Click Change Settings under Schedule optimization.
-
Enable the Run on a schedule (recommended) checkbox if it isn't already.
-
You can change the frequency of the optimization to Daily, Weekly, or Monthly.
- Click Choose to select the drives you want to be part of the scheduled optimization.
-
You can choose the drives you'd like to optimize and whether you want new drives to be optimized automatically.
- Click OK and then OK again to save your settings.
And that's about all you need to do to defragment your drive on a schedule. This is definitely the easiest way to go about it, but there are other methods.
Defragment your drive using Windows Terminal (or Command Prompt)
If you'd rather use a command line interface to defragment your disk, you can use Windows Terminal or Command Prompt to do this as well. You can either defragment or trim your drive, depending on whether you have an SSD or HDD.
-
Press Windows + X on your keyboard and choose Terminal (Admin) from the menu.
-
The command you need to run depends on the kind of drive you have. In either case, you'll have to replace {DriveLetter} with the respective drive letter for the drive you want to defragment or trim.
-
If you have an SSD:
Defrag {DriveLetter} /L -
If you have an HDD (do not use this command on an SSD):
Defrag {DriveLetter}
-
If you have an SSD:
-
Wait for the process to finish, which may take a while.
There are a lot of additional arguments you can use for the Defrag command for different kinds of optimizations and tasks. Adding the /A argument lets you analyze a drive to see if it needs optimization, while the /B argument lets you optimize the boot performance, for example.
Defragmenting is mostly unnecessary today
That's about all you need to know to defragment your drive on Windows 11. While this can improve the performance of some computers, most PCs today, especially more premium laptops, only come with M.2 SSDs, which don't need this kind of optimization that much. And even then, Windows 11 usually runs optimization by default on a set schedule, so there should be no need to mess with it.
If you want to save some space on your PC, there are some more effective solutions, like deleting temporary files that can often be left over.
How to clear the cache on Windows 11
If you have a lot of temporary files clogging up your system, clearing the cache on Windows 11 can help free up some space.