How to Defrag and Optimize Drives in Windows 10

To defrag a drive in Windows 10, type defrag in the search box on the taskbar and select Defragment and Optimize Drives. Select the drive, then select Optimize. Windows defragments hard drives and trims SSDs, and it already does this once a week on its own.

Applies to: Windows 10. Microsoft ended Windows 10 support on October 14, 2025, so a PC without Extended Security Updates no longer receives security fixes; that program runs until October 12, 2027.

Defrag or optimize a drive

  1. Select the search box on the taskbar and type defrag.
  2. Select Defragment and Optimize Drives.
  3. Select the drive you want to work on. The Media type column shows whether it’s a Hard disk drive or a Solid state drive.
  4. For a hard drive, select Analyze to see how fragmented it is.
  5. Select Optimize.
Windows 10 Optimize Drives window with a hard disk drive selected and the Optimize button highlighted
Select the drive (1), then select Optimize (2).

Hard drives and SSDs are treated differently

  • Hard disk drives are defragmented. Windows moves the pieces of each file together so the drive can read them faster.
  • Solid-state drives are trimmed instead. Trim tells the SSD which blocks are free so it can clean them up in the background. Windows 11 users can follow trimming an SSD in Windows 11.

Optimize Drives picks the right method for you. Don’t use a third-party defrag tool on an SSD. It wears the drive without making it faster.

Change the automatic schedule

  1. In Optimize Drives, under Scheduled optimization, select Change settings.
  2. Keep Run on a schedule (recommended) checked.
  3. Choose Daily, Weekly, or Monthly.
  4. Select Choose to pick which drives are included, and select OK.
Windows 10 Optimize Drives schedule settings with the Weekly frequency highlighted and OK highlighted
Choose how often it runs (1), then select OK (2).

Weekly is the default and works for most PCs.

Defrag from the command line

Open Command Prompt as an administrator and run defrag C: /O. The /O option uses the right method for the drive type. To only analyze, run defrag C: /A.

Optimize with PowerShell

In PowerShell as an administrator, Optimize-Volume -DriveLetter C -Verbose runs the right kind of optimization for the drive and shows its progress. To trim an SSD specifically, add -ReTrim. To defragment a hard drive, add -Defrag.

How long it takes

Trimming an SSD usually finishes in seconds to a minute. Defragmenting a hard drive can take from a few minutes to several hours the first time, depending on its size and how fragmented it is. You can keep using the PC, though it may feel slower until it finishes.

Troubleshooting

  • Optimize is greyed out. The drive may be a network drive, a FAT32 USB stick, or not supported. Optimize Drives only works on NTFS and ReFS drives.
  • Current status says “Optimization not available”. This is normal for some removable and virtual drives. You don’t need to do anything.
  • The schedule never seems to run. Optimization runs when the PC is idle. Leave it on and idle for a while, or run it by hand.
  • Media type says Hard disk drive, but you have an SSD. Run winsat formal from an administrator Command Prompt, which re-checks the drive type, then reopen Optimize Drives.

Frequently asked questions

Will defragging make my PC faster?

It helps a hard drive that’s badly fragmented. It won’t speed up an SSD, and a PC that’s slow for other reasons needs other fixes, such as freeing up space.

How do I free up space on the drive?

Start with running Disk Cleanup in Windows 10, then work through the other ways to free up space in Windows 10.

How often should I defrag?

Let the weekly schedule handle it. Running it by hand more often doesn’t help, and an SSD never needs a manual defrag.

Is it safe to stop a defrag partway?

Yes. Select Stop in Optimize Drives. Files aren’t damaged, and the next run continues the work.

Can I defrag an external hard drive?

Yes, if it’s formatted as NTFS. Select it in Optimize Drives and choose Optimize. Keep it plugged in until it finishes.

Does Windows 11 optimize drives the same way?

Yes. Optimize Drives, the weekly schedule and the defrag command work the same in Windows 11.

For more detail, Microsoft’s support page is Defragment / optimize your data drives in Windows.