How to Trim SSD in Windows 10

TRIM is a special ATA command which was developed to keep the performance of your SSD drives at peak performance for the duration of your SSD's life. TRIM tells the SSD controller to erase invalid and not used data blocks from the storage in advance, so when a write operation happens, it finishes faster because no time is spent in erase operations. Without TRIM automatically working at the system level, your SSD performance will degrade over time unless you manually use a tool which can send the TRIM command to it.

By default, TRIM is enabled for all SSDs. However, it is a good idea to check if TRIM is correctly enabled for your SSD in Windows 10 before proceeding. Refer to the following article:

How to see if TRIM is enabled for SSD in Windows 10

In Windows 10, TRIM is supported for both NTFS and ReFS file systems. If it is disabled, you can enable it manually. After that, you might want to TRIM your SSD manually. In Windows 10, this can be with PowerShell.

To Trim an SSD in Windows 10, you need to use the Optimize-Volume cmdlet.

The Optimize-Volume cmdlet optimizes a volume, performing defragmentation, trim, slab consolidation, and storage tier processing. If no parameter is specified, then the default operation will be performed per the drive type as follows.

  • HDD, Fixed VHD, Storage Space. -Analyze -Defrag.
  • Tiered Storage Space. -TierOptimize.
  • SSD with TRIM support. -Retrim.
  • Storage Space (Thinly provisioned), SAN Virtual Disk (Thinly provisioned), Dynamic VHD, Differencing VHD. -Analyze -SlabConsolidate -Retrim.
  • SSD without TRIM support, Removable FAT, Unknown. No operation.

In our case, we need to pass the -ReTrim argument to the cmdlet to start the Trim operation. The syntax is as follows.

Optimize-Volume -DriveLetter YourDriveLetter -ReTrim -Verbose

Replace the YourDriveLetter portion with your solid state drive partition letter.

Open an elevated PowerShell and type the command above. The letter of my SSD drive is F, so my command looks as follows.

Optimize-Volume -DriveLetter F -ReTrim -Verbose

Windows 10 Trim Ssd

When finished, close the PowerShell window.

The cmdlet will generate TRIM and Unmap hints for all currently unused sectors of the volume, notifying the underlying storage that the sectors are no longer needed and can be purged.

This can recover unused capacity on thinly provisioned drives.


5 thoughts on “How to Trim SSD in Windows 10

  1. PB

    Or just use the defrag tool built into Windows 10. The Optimise button carries out TRIM command on SSD and Defrag on non-SSD HDD.

  2. Kris

    When executing the command in the post, I get the error ‘Optimize-Volume’ is not recognized as an internal or external command, operable program or batch file.

    Running Windows 10 Enterprise. You’d think that Windows 10 is Windows 10, but (of course) that is not the case.

    Typical Windows /rolleyes.

    1. Ruben

      So basically you opened >cmd< and didnt get it to work and blame windows?
      You'd think that Windows 10 users would be able to follow written instructions, but (of course) that is not the case.

      Typical Kris /rolleyes.

      Sarcasm aside, try powershell and not cmd.

  3. Mikac

    you can use CMD to call PS and run TRIM command:

    powershell -executionpolicy bypass Optimize-Volume -DriveLetter C -ReTrim -Verbose

  4. thierrybo

    As all my searches to change a HDD to SDD win windows 10 did not succeeded,
    This page is useful because at least I can trim the disk manually :

    PS C:\WINDOWS\system32> Optimize-Volume -DriveLetter G -ReTrim -Verbose
    COMMENTAIRES : Invocation de réoptimisation sur KINGSTON_SSD_A400 (G:)…
    COMMENTAIRES : Réoptimisation : 0 % effectués…
    COMMENTAIRES : Réoptimisation : 100 % effectués.
    COMMENTAIRES : Passe 1 :
    COMMENTAIRES : Réoptimisation : 48 % effectués…
    COMMENTAIRES : Réoptimisation : 56 % effectués…
    COMMENTAIRES : Réoptimisation : 63 % effectués…
    COMMENTAIRES : Réoptimisation : 69 % effectués…
    COMMENTAIRES : Réoptimisation : 74 % effectués…
    COMMENTAIRES : Réoptimisation : 81 % effectués…
    COMMENTAIRES : Réoptimisation : 89 % effectués…
    COMMENTAIRES : Réoptimisation : 97 % effectués…
    COMMENTAIRES : Réoptimisation : 99 % effectués…
    COMMENTAIRES : Réoptimisation : 100 % effectués.
    Post Defragmentation Report:
    Informations sur le volume :
    COMMENTAIRES : Taille du volume = 223,44 Go
    COMMENTAIRES : Taille du cluster = 4 Ko
    COMMENTAIRES : Espace utilisé = 119,79 Mo
    COMMENTAIRES : Espace libre = 223,32 Go
    Réoptimisation :
    COMMENTAIRES : Allocations sauvegardées = 223
    COMMENTAIRES : Allocations optimisées = 221
    COMMENTAIRES : Espace total optimisé = 220,92 Go
    PS C:\WINDOWS\system32>


Leave a Reply

Your email address will not be published. Required fields are marked *