sodcalculator

10 Tech How-To

How to Defrag Windows: Step-by-Step Guide

Guide 10-44987 · Updated · Step by step

Defragmenting your hard drive rearranges fragmented data so your PC can access files faster, improving overall performance. This guide shows you how to defrag on Windows 10 and 11, using the built-in tool. You don’t need any extra software—just a few minutes and a drive that’s more than 10% full.

What You’ll Need

  • A Windows 10 or 11 PC with an HDD (hard disk drive). SSDs should not be defragmented—Windows handles them automatically with a different optimization.
  • Administrator access (you’ll need to be logged in as an admin or know the admin password).
  • At least 10% free space on the drive (the tool needs room to move files).

Step-by-Step

  1. Open the Defragment Tool. Click the Start button, type “Defragment and Optimize Drives” in the search bar, and press Enter. Alternatively, press Windows + R, type dfrgui, and hit Enter.
  2. Select your drive. In the window that opens, you’ll see a list of drives. Click the drive you want to defrag (usually C:).
  3. Check the media type. Look under the “Media type” column. If it says “Solid state drive,” skip this step—don’t defrag an SSD. If it says “Hard disk drive,” continue.
  4. Click “Optimize.” This starts the defragmentation process. It may take from a few minutes to several hours, depending on drive size and fragmentation level. You can keep using your PC, but it’ll be slower during the process.
  5. Monitor progress. The “Current status” column shows a percentage. You’ll see “0% fragmented” when it’s done. You can safely close the window—the process continues in the background.
  6. Set a schedule (optional). Windows runs defrag automatically on a weekly schedule by default. To check or change it, click “Change settings” and ensure “Run on a schedule” is enabled. Choose a frequency (daily, weekly, monthly) and the drives to include.

Common Mistakes

  • Defragging an SSD. This wears out the drive and offers no performance benefit. Always check the media type first.
  • Running third-party defraggers. Windows’ built-in tool is sufficient for most users. Third-party tools can cause conflicts or be unnecessary.
  • Interrupting the process. If you shut down or restart mid-defrag, you might lose progress and it could take longer next time. Let it finish.
  • Defragging a nearly full drive. If you have less than 10% free space, the tool may not work effectively. Free up space first.
  • Expecting miracles. Defragging won’t fix a dying drive or a malware infection. It only helps with file fragmentation.

Tips

  • Run defrag when you don’t need your PC for a while, like overnight.
  • If you use an external HDD, connect it directly via USB (not a hub) for faster operation.
  • Keep your drive at least 15% free for best results.
  • Windows automatically defrags HDDs weekly, so manual runs are rarely needed unless you add/remove lots of large files.
  • For SSDs, use the same tool but click “Optimize”—Windows will run TRIM (a different process) instead of defrag.

Troubleshooting

The Optimize button is grayed out. This usually means the drive is an SSD or the drive is not recognized. Check the media type. If it’s an HDD and still grayed out, try running the tool as administrator (right-click the Start button, select “Windows Terminal (Admin)”, then type dfrgui).

Defrag keeps stopping at a certain percentage. This can happen if the drive is heavily fragmented or has bad sectors. Run chkdsk /f from an elevated command prompt to check for errors, then try again.

The process is extremely slow. If it’s taking more than a few hours, your drive might be failing. Back up your data immediately and consider replacing the drive.

You see “0% fragmented” but performance hasn’t improved. Fragmentation might not be the cause. Check for other issues like low RAM, too many startup programs, or malware.

Windows says “Optimization is not available.” This can happen on virtual drives or network drives. Defrag only works on physical internal drives.

Frequently Asked Questions

How often should I defrag my Windows PC?

Windows automatically defrags HDDs weekly. You only need to manually run it if you’ve added or deleted many large files (like games or videos) and notice slowdowns.

Does defragging delete my files?

No. Defragmentation only rearranges where files are stored on the disk. It doesn’t delete or modify any data.

Can I use my computer while defragging?

Yes, but the system will be slower because the disk is busy. It’s best to avoid heavy tasks like gaming or video editing during the process.

Is defragging safe for SSDs?

No. SSDs don’t need defragmentation, and doing so can reduce their lifespan. Windows automatically disables defrag for SSDs and uses TRIM instead.

What’s the difference between defrag and TRIM?

Defrag rearranges data on HDDs to reduce read/write head movement. TRIM tells an SSD which blocks are no longer in use, so it can clean them up in the background. Both are handled by the same Windows tool.

How do I know if my drive is fragmented?

Open the Defragment and Optimize Drives tool. Under “Current status,” it shows the fragmentation percentage. If it’s above 10%, defragging can help.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →