How To Defragment And Optimize Drives In Windows 11 (2026)
Windows 11 already defragments and optimizes your drives on a schedule, so most people never need to run it by hand.
To check or run it yourself, type defrag in the taskbar search and open Defragment and Optimize Drives.
This guide covers the steps, the schedule, how hard drives and SSDs are treated differently, and the defrag command.
Quick answer: open Optimize Drives
| Question | Answer from Microsoft |
|---|---|
| Where is it? | Taskbar search > type defrag > Defragment and Optimize Drives |
| Do I need to run it? | Usually no, because Windows optimizes data drives automatically |
| How often does it run? | Once a week by default |
| Hard drive (HDD) | Analyze to check it, Optimize to run it now |
| SSD | Windows trims it instead of defragmenting it |
These points come from Microsoft’s support page on defragmenting and optimizing your data drives.
Open Defragment and Optimize Drives
- Select the search box on the taskbar.
- Type defrag.
- Choose Defragment and Optimize Drives from the results.
The tool lists your drives, and you select the one you want to work with.
Microsoft says this tool is for reviewing a drive’s status or changing the schedule, because Windows handles the work on its own.
Analyze or optimize a hard drive
- Open Defragment and Optimize Drives.
- Select the hard disk drive (HDD) in the list.
- Select Analyze to check whether it needs optimization.
- Select Optimize to run it now.
Microsoft’s page describes the Analyze and Optimize buttons for hard drives only.
If you have an SSD, the page does not give you a button to defragment it,.
What optimization does on an HDD and an SSD
| Drive | What optimization means | Source detail |
|---|---|---|
| Hard disk drive (HDD) | Defragmentation: files are lined up together so the drive reads them more easily | Microsoft support page |
| Solid state drive (SSD) | Trimming: the drive is told when it can safely do cleanup work while idle | Microsoft support page |
Microsoft calls both kinds of work “optimization”, which is why one tool covers both.
If you are not sure which kind of drive you have, our guide to checking SSD or hard drive health shows where Windows lists the disk type.
Change the optimization schedule
- Open Defragment and Optimize Drives.
- Under Scheduled optimization, select Change settings.
- Select the drive you want to change.
- Choose daily, weekly or monthly, or turn the schedule off for that drive.
The default is once a week.
Microsoft also says you can have the schedule run more often if a drive misses its optimization three times in a row.
How the schedule treats an SSD
The defrag command reference on Microsoft Learn gives extra detail about SSDs in the scheduled task.
| Situation | What happens |
|---|---|
| Normal scheduled run on an SSD | Traditional optimization and retrim run once a month, even if the task is set to weekly |
| You manually defragment an SSD | The next scheduled run analyzes and retrims it but skips traditional defragmentation |
| Both are skipped | Analysis does not run, so Last run in Optimize Drives can be up to a month old |
That last row explains why an SSD can show an old Last run date without anything being wrong.
Why the scheduled run may not finish a drive
Microsoft Learn says the maintenance task may not defragment every volume in three situations.
- The computer is asleep and the task does not wake it.
- The computer is running on battery power.
- The computer resumed from idle.
A laptop that runs on battery most of the time can therefore skip optimization.
Keeping it plugged in and awake when the schedule runs gives Windows the chance to finish.
Run defrag from the command line
Open Terminal or Command Prompt as an administrator, because Microsoft says the command needs administrator rights.
defrag c: /u /vThat example from Microsoft defragments drive C and prints progress and verbose fragmentation statistics.
| Parameter | What it does |
|---|---|
| /a | Analyzes the volume |
| /o | Does the proper optimization for each media type |
| /l | Retrims the volume |
| /u | Prints the progress on screen |
| /v | Prints verbose output with fragmentation statistics |
| /c | Runs on all volumes |
| /h | Runs at normal priority, instead of the default low priority |
| /m | Runs on each volume in parallel in the background |
Microsoft’s example defrag /c /h /v runs on all volumes at normal priority with verbose output.
Press Ctrl+C to interrupt a running command.
What defrag cannot work on
- Volumes locked by the file system.
- Dirty volumes, which need a chkdsk run first.
- Network drives.
- CD-ROMs.
- File systems other than NTFS, ReFS, FAT or FAT32.
If a drive is marked dirty, run error checking first with our guide to checking and repairing drive errors.
Free space needed for a full defrag
Microsoft says a volume needs at least 15% free space for a complete defragmentation.
With less than that, defrag only partly defragments the volume.
Free up room by deleting files you do not need or moving them to another disk, as covered in our guide to freeing up disk space.
If your PC is slow
Windows already optimizes your drives weekly by default, so running it again is unlikely to be the fix for a slow PC.
Check what is using the processor, memory and disk first with the steps in our slow PC guide.