What is Defragmentation?
This is when it becomes necessary to perform defragmentation. Once initiated, a special type of a program will run through your hard drive and re-locate fragmented file sequences closer to each other. These types of programs are referred to as Disk Defragmenters. They are designed to minimize disk fragmentation and improve your computer performance as well as hardware preservation by doing so. Heavily fragmented files take much longer to load than defragmented ones. It is therefore very important to defragment them every once in a while.
How to Defrag a Computer
Windows users are already equipped with a pre-installed Disk Defragmenter utility. Although the standard outdated Windows XP Disk Defragmenter utility is not exactly the best utility out there, it still does get the job done and that's what ultimately matters. There are quite a few other third party disk defragmenters that are considerably faster and more efficient, but the best ones usually come with a price. Since 100% top notch performance is probably not really that much of an issue to an average computer user, the standard application will work just fine.
Start the Disk Defragmenter utility in Windows XP by accessing your Start menu and then:
All Programs > Accessories > System Tools > Disk Defragmenter.

Unfortunately, this version of the built in Disk Defragmenter utility does not support scheduled defragmentation. You will have to manually defragment all of your drives.
Windows Vista and Windows 7
Windows Vista and Windows 7 users do not have to worry about fragmentation issues since the new version of the utility is greatly improved and it is now set to perform scheduled defragmentation usually at 1 A.M. every Wednesday. New capabilities include simultaneous multiple drive defragmentation, faster defrag runtime and more.

If you would like to change the schedule, click the Modify schedule button in Windows Vista or Configure schedule in Windows 7 and use the drop down menus to set the values that suit you most.

Pay close attention to the time option. In case that you do not use your computer at night, you should set it to a value which will correspond to the time during the day when you are most likely to be at your computer. Or have it turned on.
By default, scheduled defragmentation is enabled on all of your drives and also on any new ones that might become available later. You can modify these settings by clicking the Select disks button.

How Often Should I Defrag?
As already mentioned, if you are using a newer version of Windows such as Windows Vista or Windows 7, you do not have to worry about defragmentation at all. Otherwise, it is recommended to defrag your hard drives at least once in every 2-3 weeks. It actually depends on how much you use your computer.
The Disk Defragmenter utility has a handy Analyze feature that will let you know whether you need to defragment your hard drive or not.
Also, defragmentation should be performed on all removable storage devices that physically write files onto themselves. In other words, if you own an external hard drive, do not forget to defragment it occasionally.
Sometimes Less is More
Performing defragmentation too often can be potentially hazardous both for your hard drive and files. Defragmentation causes a considerably higher hard drive activity than usual. Like with everything else, the golden middle is somewhere in between. Again, once in every 2-3 weeks is usually enough for the average computer user.
What Not to Defragment
Memory cards, flash drives, mp3 players, and any other solid state devices that store information on chips should never be defragmented. There are absolutely no performance gains since no moving parts are involved in forming the files. These devices do not have read/write heads such as those found in a hard drive.
In this case, the exact opposite is true. Instead of hardware preservation, the only thing achieved will be hardware degradation.
Writing to a flash memory too often will shorten its lifespan considerably. Defragmentation is completely useless in terms of performance optimization and it will only hurt the device by wearing it out with many unnecessary writing operations.
Follow-Up Reading
Check out the guides page for more performance optimizing tips as well as everyday computing and security. Learn about how to protect yourself from malicious threats such as information hijacking, computer viruses, and spyware.