Does Windows Defragment Your SSD? What Optimize Drives Really Does (Checked in a Real PC's Event Log)
You may have read both that you must never defragment an SSD and that Windows quietly defragments it anyway. Both are half right. I checked Microsoft's documentation for the Optimize Drives task and then read ten weeks of the storage optimizer's event log on a Windows 11 PC that has an NVMe SSD and two hard disks side by side. The result: Windows treats each drive type differently, sends TRIM to the SSD every week, and by its own documented policy runs a traditional defragmentation on an SSD at most once a month. Below is what that means, what the log showed, and the two commands that let you check your own PC.
The short answer
Leave the built-in optimization on and do not defragment an SSD yourself. Windows already knows which of your drives is an SSD. For that drive the weekly task sends TRIM — it tells the SSD which blocks are no longer in use — and, according to Microsoft, does a traditional defragmentation only on a monthly cadence. A hard disk in the same PC is analyzed and defragmented instead.
What Microsoft documents
Two Microsoft Learn pages describe the behavior. The Optimize-Volume page lists the default operation per drive type when you run it without options:
| Drive type | Default operation |
|---|---|
| HDD, fixed VHD, Storage Space | Analyze, then Defrag |
| SSD with TRIM support | Retrim |
| Thinly provisioned storage, dynamic VHD | Analyze, Slab consolidate, Retrim |
| SSD without TRIM support, removable FAT, unknown | No operation |
Retrim, in Microsoft's words, generates TRIM and unmap hints for all currently unused sectors of the volume, notifying the storage that they are no longer needed. It does not move your files.
The defrag command page adds the scheduled-task rules. The task typically runs every week. For SSDs it applies 'traditional optimization processes' — traditional defragmentation, which moves files to make them reasonably contiguous, and retrim — once per month, and changing the task's frequency does not change that monthly cadence. If you defragment an SSD manually between runs, the next scheduled run skips traditional defragmentation on it. The task does not wake a sleeping PC and does not run on battery.
So the honest version of 'Windows never defrags SSDs' is: Windows defragments an SSD rarely and on purpose, and TRIMs it regularly.
What a real PC's event log shows
The test PC runs Windows 11 Home with three disks: a 1 TB Crucial NVMe SSD (C:), a 1 TB hard disk split into D: and E:, and a 4 TB hard disk. Get-PhysicalDisk reported MediaType SSD for the first and HDD for the others. The scheduled task Microsoft\Windows\Defrag\ScheduledDefrag runs defrag.exe -c -h -o, where -o means 'perform the proper optimization for each media type'.
The storage optimizer writes event ID 258 to the Application log each time it finishes a drive. On 2026-10-10 the log still held 2026-07-30 to 2026-10-07, and the task had run every week — 11 runs in a row:
| Drive | What the log recorded each week | Weeks |
|---|---|---|
| C: NVMe SSD | retrim completed, and defragmentation completed at the same second | 11 of 11 |
| D: and E: hard disk | defragmentation completed | 11 of 11 |
The SSD's two entries carry the same timestamp every week, and the event text does not say what work was done, so the log cannot tell you whether a full defragmentation ran or how much was moved. It does confirm the useful part: without anyone touching it, Windows optimized every drive every week, and the SSD got its retrim. Trying defrag C: /A without administrator rights failed with an access error — running it yourself requires an elevated prompt.
Check your own PC
Is TRIM on? This works in a normal Command Prompt or PowerShell, no administrator rights needed:
fsutil behavior query DisableDeleteNotifyNTFS DisableDeleteNotify = 0 means TRIM commands are sent to the storage device. 1 means they are not.
When did Windows last optimize each drive? Read the same event log the test used:
Get-WinEvent -FilterHashtable @{LogName='Application'; ProviderName='Microsoft-Windows-Defrag'; Id=258} -MaxEvents 20 | Format-Table TimeCreated, Message -WrapOr search the taskbar for defrag and open Defragment and Optimize Drives. Each drive is listed with its media type, so you can see that Windows recognizes your SSD as one, when it was last optimized, and whether scheduled optimization is on. Microsoft's support article notes the default schedule is weekly.
Should you defragment an SSD yourself?
No. Crucial, the maker of the SSD in this test, recommends disabling defragmentation on SSDs: with no moving parts, performance losses from fragmentation are negligible, while defragmentation performs an enormous number of small writes, and writes are what wear an SSD out. One accidental pass is nothing to worry about; doing it frequently with a third-party tool can, in Crucial's words, cut months or years from the drive's life in extreme cases.
The same Crucial page says Windows' own Optimize, which sends TRIM to an SSD, is perfectly fine. So the practical rule is: keep Windows' scheduled optimization on, do not install a separate defragmenter for an SSD, and do not turn optimization off just because you have an SSD — that also stops the regular retrim.
FAQ
Q. Does Windows 11 defragment SSDs?
Rarely and by design. Microsoft's defrag documentation says the scheduled task runs a traditional defragmentation and retrim on SSDs once per month. The regular weekly work on an SSD is retrim (TRIM).
Q. Is it bad to click Optimize on an SSD?
No. For an SSD, Optimize sends TRIM rather than moving files. Crucial's support article calls this perfectly fine. What you should avoid is frequent full defragmentation with a third-party tool.
Q. How do I know TRIM is enabled?
Run fsutil behavior query DisableDeleteNotify. If the NTFS line says 0, TRIM is enabled. It does not need administrator rights.
Q. Should I turn off scheduled optimization for my SSD?
No. Turning it off also stops the periodic retrim. Windows already applies the right operation for each media type.