When your Windows operating system reads a file off a hard-disk, it’s reading a file stored in lots of little bits -usually 512-bit chunks in NTFS. Your operating system doesn’t always, in fact rarely does it, write to the disk putting all of the separate 512-bit chunks next to each other. Sometimes different chunks get put far away from one another, in fact. A file could end up getting spread all over the hard-disk at random.
When you run a defragmenter, it puts all those little bits of file closer together, usually consecutively, so that the heads take less time finding them. Moving the read-write heads takes time and with the electromechanical hard-drive being the slowest component and greatest bottleneck for data in the computer as it is, the last thing you want it to do is go any slower. (The standard hard-drive is the only component with moving parts: All other devices – except for fans – are solid-state.) The defragmentation process ensures that the file data is contiguous so that the head doesn’t require so much movement, and thus the read time is faster.
Flash drives don’t have a read/write head. In fact flash drives don’t have any moving parts. The flash drive’s electronics present the drive to the computer as a standard hard-drive by mimickery, but the data-storage is accomplished by so-called “flash-cells” which consist of a number of transistors each, rather than a set of spinning platters.
Defragmenting a flash drive will get you very few, if any, performance increases other than perhaps a slightly increased write-time on certain drives. As there are no read/write heads to move, there is no additional time spent retrieving data from any separate flash-cells, no matter how far apart they may be. What defragmenting will do though is wear the flash-cells out faster.
When a write is made to any given flash-cell, it causes a tiny amount of degradation in the components of that cell. This might not be true to such an extent much longer, as the underlying technology is constantly improving, but nevertheless, at present and probably for a long time into the future, it will be the case to some extent. The more you write to a flash-device, the shorter its life will be. Normal usage is OK; but it still won’t last forever. (What does?)
Regularly defragmenting it unnecessarily, however, will add many thousands of write operations whenever you do it, and might even halve its lifespan.
Defragment your electromechanical (standard) hard-drives regularly and it will improve file performance. Defragment a flash or SSD drive, though, and you’re just wearing it out for no good reason.