How to Defrag Windows 7 (and When Not To)

To defragment a hard drive in Windows 7, click Start, type Disk Defragmenter, and open it. Select the drive, click Analyze disk, then Defragment disk if it’s more than about 10% fragmented. Defragmenting rearranges scattered pieces of files on a hard disk so Windows can read them faster. Windows 7 runs Disk Defragmenter automatically once a week by default, but you can analyze and defragment manually anytime. Leave SSDs out of it.

Disk Defragmenter window listing drives with last run and percent fragmented, and the Analyze disk and Defragment disk buttons highlighted
Analyze a drive first, then defragment it if fragmentation is high.

Before You Start

  • Check the drive type. Defragment hard drives (HDDs), not SSDs. Windows 7 usually detects SSDs and excludes them from the schedule.
  • Close programs and plug in laptops.
  • Free up space first with Disk Cleanup; defragmenting works best with at least 15% free.
  • Back up important files if the drive is old or making noises.

Defragment Manually

  1. Open Start, type Disk Defragmenter (or run dfrgui), and press Enter.
  2. Select the drive under Current status.
  3. Click Analyze disk. The Last Run column shows the fragmentation percentage.
  4. If it’s above about 10%, click Defragment disk.

It can take from minutes to hours. You can keep using the PC, but it will be slower.

Can I stop defragmenting partway?

Yes. Click Stop operation; it’s safe.

Set or Change the Schedule

  1. In Disk Defragmenter, click Configure schedule.
  2. Check Run on a schedule, pick frequency, day and time, and choose drives.
  3. Click OK.

Schedule it for a time the PC is on but idle.

How often should I defragment?

The weekly schedule is enough. Manual runs help after installing or deleting lots of large files.

Use the Command Line

Open Command Prompt as administrator:

  • defrag C: /A: analyze only
  • defrag C: /U /V: defragment with progress and a detailed report
  • defrag /C /U: defragment all drives

Why Not Defragment an SSD?

SSDs access data equally fast wherever it’s stored, so defragmenting doesn’t help and adds unnecessary writes. Windows 7 supports TRIM for SSDs, which keeps them performing well. If an SSD shows in Disk Defragmenter’s schedule, remove it.

Other Ways to Speed Up Windows 7

  • Run Disk Cleanup and uninstall programs you don’t use.
  • Disable unneeded startup programs with msconfig > Startup.
  • Scan for malware.
  • Consider upgrading to an SSD; it makes the biggest difference on older PCs. See tips to speed up a Windows 7 laptop.

A Note on Windows 7

Windows 7 has been unsupported since January 14, 2020 and no longer receives security updates. If the PC is still in use, plan an upgrade or replacement, and avoid using it for banking or sensitive tasks.

Still keeping an even older machine for one program? Here is how to speed up Windows XP and keep it offline.

On a newer PC, see how to defrag Windows 11, including how it handles SSDs.