Skip to main content

How to defrag your computer

For decades, desktop and laptop owners have been told to defragment their hard drives to get the best performance, especially on Windows-based PCs. Defragging reorganizes the drive so the operating system isn’t spending more time gathering up all the scattered pieces when loading a program or file.

But times have changed. Modern PCs mostly depend on solid-state drives (SSDs), which don’t require or really support old-school defragmentation — indeed, it can actually harm their overall performance and lifespan. Even on computers with hard drives, MacOS and Windows are now more efficient than ever and perform the cleanup in the background. Likewise, Linux-based Chrome OS writes files in an extremely logical manner, requiring very little background defragmentation.

This guide will walk you through how to defrag your PC, but before you do, make sure that it’s worth doing.

Don’t defrag an SSD

OCZ SATA SSD
SATA SSD Auxo.co.kr

SSDs don’t share the same fragmentation problem as hard drives. There are no mechanical parts that move in search of file bits. Files can be fragmented, sure, but you won’t see the performance issues associated with spinning platters and moving heads. SSDs can find scattered blocks of data really fast.

Running a manual defrag on an SSD can be bad for the drive, too. Why? Because data is written to memory cells versus being stored magnetically in tracks on a platter. Over time, these cells wear out — defragmenting will reduce their overall lifespan. Moreover, SSDs use “wear-leveling” to write data across all cells so that they wear out evenly rather than in chunks.

Unlike hard drives, data is written to SSDs in pages — 128 pages equals one data block. Without the TRIM command, the SSD controller will temporarily move pages of wanted, valid data into memory, delete the pages of unwanted, invalid data, wipe the block clean, and then write the valid pages back into the block. Garbage collection takes place when the computer is idle.

The TRIM command is more efficient. It tells the SSD controller which pages of a block can be erased. Thus, instead of erasing the entire block and rewriting the valid data, the controller marks the invalid pages for garbage collection. This method prolongs the life of the SSD.

Ultimately, an SSD doesn’t need defragmenting. Moreover, manually defragmenting the drive will reduce its overall lifespan, so just let Windows and the SSD do their trash collection dance in the background.

You don’t need to defrag a Mac or Chromebook

Image used with permission by copyright holder

Modern Macs do not rely on hard drives but rather SSDs. However, if your Mac does have a hard drive, MacOS silently defrags the drive in the background, just like Windows 10.

On a deeper level, Apple’s older Hierarchical File System (HFS+) uses Hot File Adaptive Clustering, which automatically prevents file fragmentation by moving files that are frequently accessed (and mostly unchanged) to a special section. The newer APFS system, initially only supporting SSDs but expanded to hard drives and Fusion drives in Mojave (10.14), creates file snapshots instead.

While there isn’t a native defrag application built into MacOS like there is in Windows, you can find a few third-party tools to manually defrag the drive. Problem is, they don’t work with the newer Apple File System (APFS) built into High Sierra (10.13) and newer. These include:

Meanwhile, like modern Macs, Chromebooks don’t need defragging, as they rely on flash-based storage. Moreover, Chrome OS is based on Linux, which uses the ext2, ext3, and ext4 file systems. These platforms save files in different places with enough blank space around them to accommodate growth. If files become fragmented, the platform will move these files around to combine the scattered bits.

If performance is an issue, one extreme fix it to set both devices to their factory defaults. We have separate guides for MacOS and Chrome OS (aka Powerwash).

How to defrag a hard drive in Windows 10

Defrag Windows 10 Hard Drive
Image used with permission by copyright holder

Again, Windows 10 defrags your hard drive in the background. When you open the Optimize Devices tool, you’ll likely see that the drive is 0% fragmented. However, here’s how to manually defragment the drive if needed:

Step 1: Open File Explorer.

Step 2: The “This PC” panel should appear on the screen by default, displaying your drive(s). If not, click on This PC listed on the left.

Step 3: Right-click on the hard drive you want to defragment.

Step 4: Select Properties on the pop-up menu.

Step 5: Click the Tools tab on the following pop-up window.

Step 6: Click the Optimize button displayed under Optimize and Defragment Drive.

Step 7: If you have multiple drives, select the drive you want to optimize. Otherwise, move on to Step 8.

Step 8: Click the Analyze button. If the drive doesn’t need defragmenting, then click the Close button. If your drive needs defragging, click the Optimize button instead.

Step 9: Click the Close button to finish.

Editors' Recommendations

Topics
Kevin Parrish
Former Digital Trends Contributor
Kevin started taking PCs apart in the 90s when Quake was on the way and his PC lacked the required components. Since then…
Best refurbished laptop deals: How to find cheap used computers
microsoft surface laptop go 2020 on desk

Shopping the best laptop deals can land you some savings, but if it’s an incredibly low price you’re looking for, shopping refurbished is the way to go. Refurbished laptops offer a chance to save big, and you can often find some of yesterday’s best laptops at super cheap prices today. Most refurbished laptops are backed by warranties and reasonable return windows, so you can shop refurbished laptops with some confidence what you’re purchasing will hold up. There are a lot of great refurbished laptop deals out there right now, and they are laptops that make a lot of sense for students or anyone on a tight budget. Below you’ll find links to some of the best places to buy a refurbished laptop.
Best Buy refurbished laptops -- starting at $113
Best Buy's refurbished laptops are -- you guessed it -- Geek Squad Certified and while they may not be free and clear of absolutely all cosmetic scuffs they are still exceptionally clean and always in working order. Some of them even come with additional software like virus tools, streaming access, like Apple TV+, and much more. Of course, the best part is that you can get a premium and fully upgraded model for less, often with more storage, more power, and more features than you would when buying a base model brand new. You've got some great options from Lenovo, Acer, HP, Dell, Gateway, and even Apple to choose from. The cheapest models start around $120 and increase from there. The best way to know what's available is to head over and browse for yourself.

Dell Latitude -- starting at $279
Dell sometimes discounts laptops and machines, for varying reasons, including clearance deals of the week to make way for new stock. That's pretty much the case with Dell's Latitude models with the cheapest coming in around $189 up to $229 and above. There are a lot of different models, each with individual specifications and features, so you'll have to sift through the list, especially if you know what you're looking for already.

Read more
Best external hard drive deals: Portable SSDs, game drives & more
A man uses a WD My Passport external hard drive alongside his laptop.

Whether you’re a content creator, a gamer, or you just have too much digital stuff for your computer’s internal storage capacity, an external hard drive is worth adding to your work setup. They’re convenient, often portable, and even the best external hard drives tend to be quite affordable these days. There are a lot of them seeing deals right now, and we’ve done the heavy lifting of tracking them down for you. You’ll find external hard drive deals on brands like Western Digital, SanDisk, and even Samsung among them, with many of them tailor-made for things like gaming and content storage.
Western Digital My Passport 2TB portable hard drive — $70, was $80

Western Digital has long been making affordable, portable, and mostly reliable external hard drives for some time. Its My Passport lineup is one of the most portable external hard drives out there, and though it utilizes spinning drives as opposed to solid state technology, that’s one of the things that makes these external drives so affordable. You can get a ton of storage space for cheap with a My Passport, with this 2TB model being a sweet spot in terms of pricing.

Read more
Should you turn your computer off at night? We asked an expert
Dell XPS 8930 Review

Many of us spend a sizable portion of our waking hours at or near our computers, whether it's for work, socializing, or entertainment. Practically the only time we're not using a computer, it seems, is while we're asleep. But how should your computer face those night time hours? Leaving a computer on all the time can be noisy and distracting due to fan noise, and can cost you in electricity. On the other hand, shutting down and restarting a computer regularly could cause your components to fail earlier.

So what's the right choice? Should you use a handy shortcut to shut down your computer every night? Or is it better to leave it on all the time to increase its longevity? We spoke to an expert to find out.

Read more