Defragment Windows 11: How Optimize Drives Works for Hard Drives and SSDs (and When to Skip It)

Flat illustration of an open hard-disk platter beside a slim flat SSD board, with a row of blue blocks forming an arrow between them
Flat illustration of an open hard-disk platter beside a slim flat SSD board, with a row of blue blocks forming an arrow between them

To defragment Windows 11 safely, you first need to know what kind of drive you have. On a traditional hard drive, defragmenting puts the pieces of each file back together so the drive head travels less. On an SSD there is no moving head, so Windows does something different and much lighter. Windows already runs this job on a schedule, which means most people never need to start it by hand. This guide explains what the Optimize Drives tool does for each drive type, how to run it and read the result, and why a separate optimizer program rarely adds anything.

Last reviewed: November 23, 2026. The Optimize Drives steps and the schedule follow Microsoft's support page and the defrag command reference listed under Sources. Nothing here was run on a real PC, and no speed test was made.

Quick answer

Quick answer

  • Windows optimizes your drives automatically once a week by default, so check the schedule before you run anything.
  • On a hard drive, Optimize Drives defragments. On an SSD, Windows sends a TRIM (retrim) hint instead and does not need heavy file shuffling.
  • Defragmenting only helps when a hard drive is heavily fragmented. It does not fix slow PCs caused by startup apps, low memory or a full drive.
  • You do not need a third-party defragmenter or optimizer. Back up and check the drive's health first if it is old or noisy.

In this guide

What it means to defragment Windows 11 on each drive type

A file becomes fragmented when Windows stores it in several pieces in different places on a drive. On a spinning hard drive, reading a scattered file means more head movement and more waiting. That is the problem defragmenting solves. The tool in Windows is called Defragment and Optimize Drives, and it chooses the action by drive type.

Drive typeWhat Optimize Drives doesWhat you should do
Hard disk drive (HDD)Defragments: gathers the pieces of each fileLeave the weekly schedule on. Run it by hand if the drive is heavily fragmented.
Solid state drive (SSD, including NVMe)Sends a TRIM (retrim) hint for unused space; no moving parts need arrangingLeave the default schedule alone. Do not use a heavy third-party defragmenter on it.
Hybrid or older mixed driveDepends on how Windows identifies the driveCheck the Media type column in the tool and follow the row that matches.
External USB hard driveTreated as a hard drive when connectedOptimize only when you need it and the drive is healthy.

If you are not sure which kind of drive you own, step 1 shows how to check. For choosing between the two types when buying, see how to choose an SSD.

Why files become fragmented and how to read the result

Fragmentation grows when files are saved, extended and deleted again and again, especially on a drive that is nearly full. Large downloads, videos, game updates and mail archives are common examples. When Windows cannot find one empty block big enough, it splits the file into pieces.

On a hard drive, Analyze checks whether the drive needs optimization. A scattered file means the drive head spends more time moving between its pieces. Microsoft's support page gives no percentage threshold, so treat any figure you read online as a rule of thumb, not a rule.

Fragmentation is a different problem from clutter. Junk files take up space but do not scatter your other files. If space is the issue, read our guide to computer disk cleanup or PC disk cleaner vs. Windows Disk Cleanup.

Do you need to do it?

  • Is your system drive an SSD?
  • Is the weekly optimization turned on and running?
    • Yes: Windows is already doing the job. Check the result in step 2.
    • No: turn it back on in step 3.
  • Does Analyze say the hard drive needs optimization?
    • Yes: run Optimize and leave the PC alone until it finishes.
    • No: skip it.

Step 1: Check whether you have a hard drive or an SSD

The simplest check is inside the tool itself. Select the search bar, type defrag and open Defragment and Optimize Drives. The Media type column shows Hard disk drive or Solid state drive for each drive.

For a command-line check, open PowerShell and run:

Get-PhysicalDisk | Select-Object FriendlyName, MediaType

You should see: each drive listed as HDD or SSD. If MediaType shows Unspecified, trust the Media type column in Optimize Drives (our general advice).

If this fails: if PowerShell shows an error instead of a list, skip the command and use the Media type column in Optimize Drives.

Step 2: Run Optimize Drives

  1. Open Defragment and Optimize Drives as above.
  2. Select the drive you want, such as C:.
  3. Select Analyze first. On a hard drive, Analyze checks whether the drive needs optimization. Read the result before you change anything.
  4. Select Optimize if Analyze says the drive needs it, or if the drive has not been optimized for a long time (our general advice).
  5. Wait for the run to finish. Leave the PC on and plugged in (our general advice).

You should see: the drive's status show OK once the run finishes, and the tool show when the drive was last optimized.

If this fails: if Analyze reports an error or the button is greyed out, go to the troubleshooting section below.

Step 3: Check the schedule

Microsoft's support page says Windows automatically optimizes your drives once a week by default. To check or change it:

  1. In Defragment and Optimize Drives, under Scheduled optimization, select Change Settings.
  2. Select the drive to apply changes to.
  3. Choose Daily, Weekly or Monthly, or turn the schedule off entirely. Keep Weekly unless you have a reason to change it.
  4. Set the schedule to increase the frequency if it misses optimization three times.

You should see: the drive you selected listed with the schedule you chose, or with the schedule turned off.

If this fails: restart the PC and open Change Settings again (our general advice).

Microsoft's page notes that the frequency can increase if optimization is missed three times in a row. If a drive has not been optimized for many days, the PC may have been switched off or asleep at the scheduled time. Leave it plugged in and idle once (our general advice). For the other scheduled background work that runs while the PC is idle, see our guide to Windows Automatic Maintenance.

Optional: use the command line

Open Terminal (Admin) or Command Prompt as administrator. The defrag command is documented by Microsoft. Start with analysis only, which changes nothing:

defrag C: /A /V

The /A switch analyzes and /V prints detailed results.

You should see: a report of fragmentation statistics printed in the window. If this fails: open the window as administrator, because Microsoft says the command needs membership in the local Administrators group or equivalent.

To run the proper optimization for the drive type, use:

defrag C: /O /U /V

According to Microsoft's reference, /O performs the proper optimization for each media type, and /U shows progress. Replace C: with another drive letter if needed. You do not need the other switches. Do not stop the command part-way through (our general advice).

Before you run it

  • Check drive health first. Defragmenting makes a hard drive read and write heavily. If the drive clicks, freezes or shows health warnings, back up and read how to check hard drive health before running anything. For SSDs, see checking SSD health in Windows 11. This is general advice, not a Microsoft rule.
  • Back up important files. Use our backup guide.
  • Leave free space. A nearly full drive gives the tool little room to work and can make it slow (our general advice). If your C: drive is almost full, start with finding what fills the C: drive.
  • Plug in a laptop and close big apps.

If Optimize Drives does not work

Try these in order and stop when it works:

  1. Restart the PC and try again. A restart often clears stuck background tasks (our general advice).
  2. Run it as administrator if you use the command line.
  3. Look at the drive's status. If the drive shows errors or is read-only, fix that first. See drive health.
  4. Repair system files with SFC and DISM if the tool itself will not open.
  5. Check for a conflicting tool. If you installed a third-party defragmenter or optimizer, uninstall it and try the Windows tool again.

If the tool will not list a drive, that drive may not be a type that Windows can optimize, such as some removable or network drives (our general advice). Menu wording differs between Windows builds.

Will it make the PC faster?

Mainly in one situation: a spinning hard drive with heavy fragmentation. In that case a defragment may reduce delays when opening large folders and starting programs (our general advice). It will not help much if the real problem is something else. Microsoft's tips to improve PC performance list limited storage space, too many startup apps running in the background, outdated software and hardware that no longer meets modern needs as common causes of a slow PC. To find the cause, use our guide to diagnosing a slow PC. If you moved to a cleaner or optimizer and nothing improved, see what to check when a cleaner did not speed the PC up, and use our before-and-after test to measure honestly.

If a hard drive PC is old and still slow after defragmenting, an SSD upgrade is often the change that matters most (our general advice). See what helps an old PC with a hard drive.

Third-party defragmenters and optimizers

Many programs advertise "PC optimization" with a defrag button. Windows already includes the same function, set to run weekly. A separate defragmenter can be useful for a few specialist cases on hard drives, but on an SSD an extra full defragmentation is not needed (our general advice). Be careful with tools that also offer "registry defrag" or "boost RAM"; the Microsoft pages used for this guide describe no speed benefit from either. Our guides explain the category in more detail: PC optimization software, PC cleaner vs. registry cleaner and the overview of PC cleaners for Windows 10 and 11. If you want a built-in routine instead, use our cleanup schedule. Which cleaner features are safe or pointless on an SSD versus a hard drive is covered in PC cleaners on an SSD versus a hard drive.

Windows 10 differences

The tool is the same on Windows 10. Search for defrag and open Defragment and Optimize Drives, then use Analyze, Optimize and Change Settings exactly as above. Microsoft's steps list both Windows 10 and Windows 11. The menu paths in this guide follow Windows 11, and on Windows 10 menu names can differ slightly. Windows 10 reached the end of its regular support in October 2025, so keep the PC updated as far as Microsoft allows and plan a move to Windows 11 or a newer PC. For the cleaning side, see our overview of PC cleaners for Windows 10 and 11.

Frequently asked questions

Questions about hard drives and SSDs

Should I defragment an SSD?

No. Windows treats SSDs differently and sends a retrim hint rather than moving files. Leave the schedule as it is.

Is it bad to click Optimize on an SSD?

One manual run of the Windows tool is not harmful, because it chooses the right action for the drive type. The tool is not a reason to run frequent full defragmentation with third-party software.

How often should I defragment a hard drive?

Weekly is the Windows default. Change it only if you have a reason to (our general advice).

Can defragmenting fix a full drive?

No. It rearranges files and does not free space. See what fills the C: drive.

Questions about safety and tools

Is defragmenting safe?

Yes for a healthy drive, but back up first if the drive is old or shows errors (our general advice).

Do I need a third-party defragmenter?

Usually not. Windows includes a tool that runs automatically.

Why does Windows say my drive is 0% fragmented?

Our general advice: a 0% figure suggests there is little to gain from defragmenting. Microsoft's pages do not give percentage thresholds.

Will defragmenting remove viruses or junk files?

No. It only rearranges file data. For junk, see computer disk cleanup; for malware, use Windows Security and our malware removal guide.

How this guide was checked

The tool name, the default weekly schedule, the Daily, Weekly and Monthly options and the defrag switches follow Microsoft's pages. The advice on SSDs, drive health before defragmenting, free space and third-party tools is general guidance. Menu names differ between versions, and no drive was tested for this article.

More help

For more Windows fixes, browse the PC repair guides or try the Repair Assistant.

Sources