Optimize & Defragment Drives in Windows

Use Windows “Optimize Drives” to keep disks healthy and fast. Step-by-step UI, SSD vs HDD notes, scheduling, and safe command-line options.

4–6 min read Windows
Sponsored

Why optimize/defrag helps

  • HDDs: Defragmentation groups file fragments to reduce seeks and improve load speed.
  • SSDs: TRIM lets the drive manage free blocks for steadier writes and longevity.
  • Stability: Fewer I/O stalls/timeouts that can cascade into app faults and DLL load errors.

Open Optimize Drives

  1. Open File Explorer, right-click the drive (e.g., C:) → Properties.
  2. Go to the Tools tab → Optimize.
Drive Properties - Tools tab showing Optimize
Drive Properties → Tools → Optimize.

Start optimization

In Optimize Drives, select the disk and click Optimize.

Optimize Drives dialog
Select a drive and choose Optimize.

Windows automatically chooses the correct action per media type (defrag for HDD, TRIM for SSD).

Let optimization complete

Larger or heavily fragmented disks can take longer—let the process finish without interruption.

Optimization running
Optimization in progress—you can keep using the PC.

Set a schedule

In the Optimize Drives window, click Change settings to enable automatic maintenance.

  • Frequency: Weekly is a good default.
  • Drives: Include all fixed disks. External/removable drives can be excluded.

SSD vs HDD guidance

  • SSDs: No manual defrag needed. Use Optimize (TRIM). Occasional SSD defrag by Windows (to maintain restore points) can be normal.
  • HDDs: If the disk is very fragmented or nearly full, let defrag complete with minimal background workload.
  • After maintenance: A restart isn’t required, but can help clear lingering handles/services.
Caution

Avoid frequent manual defrags on SSDs. Prefer TRIM or the scheduled maintenance Windows provides.

Command-line options

From an elevated Command Prompt:

defrag C: /O /U /V         REM Optimize volume (choose best action)
defrag /C /O /U /V         REM Optimize all volumes
defrag C: /L /U /V         REM ReTrim (SSD)

PowerShell equivalents:

Optimize-Volume -DriveLetter C -Analyze -Verbose
Optimize-Volume -DriveLetter C -Optimize -Verbose
Optimize-Volume -DriveLetter C -ReTrim   -Verbose