How to Defrag Your Windows Computer

Speed up your computer with the Windows disk defrag tool

Files stored on a hard drive become fragmented over time, meaning that parts of the files are stored in separate areas of the drive instead of right next to each other. When this happens, it can take longer for the OS to open the file. A defrag can fix this.

While there are lots of free, third-party defragmenters, the Windows disk defragmenter can be used right now without having to download anything since it's built into the operating system.

Instructions in this article apply to Windows 10, Windows 8, and Windows 7.

Should You Defrag Your Computer?

The Windows defrag tool runs automatically once a week in Windows 10, Windows 8, and Windows 7, so you probably don't need to defrag on your own. Run the analyzer first, and if it's less than 10% fragmented, the drive does not need to be defragged. If you want to defrag on your own time, anyway, you can open the program anytime you want and run a manual defrag. You can get to it by searching through Windows or by browsing through Administrative Tools via Control Panel.

Defragging isn't necessary on solid-state hard drives since there aren't any spinning parts. Since the hard drive doesn't need to spin to find all the file's pieces, there isn't a lag between the time it takes to find the file and the time it takes to open it.

of 04

Prepare Your Computer for Defragmentation

Graphic of a computer backing up

ikuvshinov / iStock

Before you defrag your computer, you must take several steps first. Read this entire procedure before you use the defrag utility.

  1. Make sure your work is backed u on an online backup service, a second local hard drive, an external hard drive, a flash drive, or a CD or DVD.
  2. Make sure the hard drive is healthy. Use CHKDSK to scan and fix the drive.
  3. Close any currently open programs, including virus scanners and other programs that have icons in the system tray (right-hand side of the taskbar).
  4. Assure your computer has a constant source of power. The important thing is to be able to stop the defragmentation process if there is a power outage.
    If you have frequent power issues or other outages, you should not use a defragmentation program without a battery backup.

If your computer does shut off while defragmenting, it may crash the hard drive or corrupt the operating system, or both.

of 04

Open the Defrag Program

Screenshot of Optimize Drives window in Windows 10

The Windows defrag program is accessible through Control Panel in all versions of Windows. Still, the procedure for getting there is slightly different depending on which version of Windows you're using.

  1. Open Control Panel. A fast way to do this in any Windows version is through the Run dialog box (WIN+R). Just enter control to open Control Panel.
  2. Go to System and Security.
  3. Select Administrative Tools.
    If you're on Windows 7, select Defragment your hard drive just below the Administrative Tools heading to open Disk Defragmenter.
  4. Windows 10 and Windows 8 users should launch the program called Defragment and Optimize Drives.

A much quicker way to get to the disk defrag utility is to run the dfrgui command in Windows 10 from the Run dialog box.

of 04

Analyze the Hard Drive

Screenshot of the Windows 10 defrag tool after the drives have been analyzed

Before starting the defrag, you'd be wise to analyze the drive first. This step checks the drive for fragments and reports back how fragmented the drive really is, after which you can choose to defrag or skip the hard drive and not run a defrag.

  1. Choose the Analyze button (Windows 10/8/XP) or Analyze disk button (Windows 7) to check for fragments on all the connected hard drives.
  2. Take note of the fragmentation level shown next to each drive.
    If the fragmentation level seems high (above 20 percent), move on to the next step to defrag the drive. Otherwise, you're probably safe skipping the defrag.
  3. Another way to know if you should defrag the hard drive is to read what the defrag tool says on the screen. If it says the drive is OK, then you're fine not running the defrag.

Windows Vista does not include an option to analyze the hard drive.

of 04

Defrag the Hard Drive

Screenshot of a hard drive being defragged in Windows 10

If you've chosen to defrag the hard drive, it's just a click away. However, the button for defragging the drive is called something different in some versions of Windows.

  1. Select the hard drive you want to defrag.
  2. Click the button to start the defrag.
    1. Windows 10 and Windows 8 call it Optimize. Windows 7 uses the term Defragment disk.

It could take anywhere from several minutes to several hours to defrag a hard drive. The time it takes to run a defrag on your hard drive depends entirely on the number of file fragments the tool identifies, the size of your hard drive, and the speed of your computer.

We have found it's best to start the defrag and then go to bed. With luck, it'll be done when you wake up in the morning.

Was this page helpful?