How to Defrag Windows 11 (HDD and SSD)

To defrag a drive in Windows 11, search the Start menu for Defragment and Optimize Drives, select the drive, and click Optimize. Windows defragments hard disk drives and sends a TRIM (retrim) command to SSDs instead, so the same button is safe for both.

Windows 11 already runs this tool on a weekly schedule, so most PCs don’t need a manual run. It’s worth doing after moving a lot of files onto a traditional hard drive, or if the tool reports high fragmentation.

Quick Answer

Start > type defrag > open Defragment and Optimize Drives > select the drive > Optimize.

How to Defrag a Drive in Windows 11

  1. Click Start and type defrag.
  2. Open Defragment and Optimize Drives.
  3. Check the Media type column. Hard disk drives get defragmented; solid state drives get retrimmed.
  4. Select a drive and click Analyze (hard drives only) to see the fragmentation percentage.
  5. Click Optimize. You can keep using the PC while it runs, though it may feel slower on a hard drive.
Optimize Drives window in Windows 11 listing a solid state drive and a hard disk drive with the Optimize button highlighted
Select the drive and click Optimize. The Media type column shows whether it’s an SSD or a hard drive.

You can also reach the tool from Settings > System > Storage > Advanced storage settings > Drive optimization.

Should You Defrag an SSD?

No, and Windows won’t. When you click Optimize on an SSD, Windows runs a retrim that tells the drive which blocks are free, which helps keep write speeds up. A traditional defrag would only add wear without a speed benefit. Occasionally Windows may also defragment an SSD that has very high fragmentation for file-system reasons, which is expected behavior and nothing to disable.

Drive type What Optimize does How often
Hard disk drive (HDD) Defragments files so they’re stored in one piece Weekly schedule is enough; manually if above about 10% fragmented
Solid state drive (SSD) Sends TRIM (retrim) Weekly schedule; no manual runs needed
USB flash drive or SD card Usually not listed or not needed Rarely

Check or Change the Automatic Schedule

  1. In Defragment and Optimize Drives, click Change settings under Scheduled optimization.
  2. Make sure Run on a schedule (recommended) is checked.
  3. Choose Daily, Weekly, or Monthly, and pick which drives to include.
  4. Click OK.

Defrag From the Command Line

Right-click Start, open Terminal (Admin), and use one of these commands:

  • defrag C: /A analyzes the drive and reports fragmentation.
  • defrag C: /O runs the right optimization for the drive’s media type.
  • defrag C: /L runs a retrim on an SSD.
  • defrag /C /O optimizes every drive.

If the PC is slow because memory is full, see how to free up and add RAM.

Troubleshooting

  • Optimize is grayed out: The drive may be in use by another optimization, formatted with an unsupported file system, or a network drive. Close other disk tools and try again.
  • Status says “Optimization not available”: This is normal for some external drives, virtual disks, and drives formatted as FAT32 in certain setups.
  • It’s stuck at a percentage: Large hard drives can take hours. Leave it running, or restart and run it again.
  • The PC is still slow: Fragmentation is rarely the main cause on modern PCs. Clearing temp files in Windows 11 and closing startup apps usually help more.

Still on an older PC? See how to defrag Windows 7.

Frequently Asked Questions

Does Windows 11 need defragging?

It needs optimization, but Windows handles it automatically each week. Manual runs mainly help hard drives that have had lots of large files added or deleted.

Does defragging speed up a computer?

On a hard drive with heavy fragmentation it can make file loading noticeably faster. On an SSD it makes no measurable difference, which is why Windows uses TRIM instead.

Is defragging the same as Disk Cleanup?

No. Disk Cleanup and Storage Sense delete unneeded files to free space. Defragmenting rearranges existing files so a hard drive can read them faster.

Can I turn off automatic defrag?

Yes, by clearing Run on a schedule in Change settings, but it’s best left on so SSDs keep getting TRIM.

Summary

  1. Search Start for defrag and open Defragment and Optimize Drives.
  2. Select the drive.
  3. Click Optimize.
  4. Leave the weekly schedule turned on.