Defragmenting your computer helps increase operating system processing speed and efficiency by rearranging files on the disk so that they take up less space. Computers with more modern operating systems, such as Mac OS X and Windows 8, perform disk defragmentation automatically, unlike older operating systems such as Windows XP, which required manual execution of the defragmentation program. Continue reading this article to learn the steps required to defrag your computer, or to change the automatic defragmentation settings.
Steps
Method 1 of 2: Defragment Windows 7 and Windows 8

Step 1. Go to the 'Start' menu and select the 'All Programs' item

Step 2. Select 'Accessories' and then 'System Tools'

Step 3. Select 'Defragmenter'

Step 4. Select the hard drive you want to defragment
For example, if you want to defragment your computer's main disk, select drive '(C:)'.

Step 5. Select the 'Scan Disk' button
The operating system will check the status of the chosen disk, determining if it needs to be defragmented.

Step 6. Press the 'Defragment disk' button, if your computer reports that the scanned drive needs to be defragmented

Step 7. Wait for the operating system to defragment the contents of the hard drive
The process may take anywhere from a few minutes to a few hours, depending on the fragmented state of the data stored on the drive.

Step 8. After the defragmentation process is complete, select the 'Activate Schedule' button

Step 9. Verify that the 'Run on a schedule' button is selected

Step 10. Specify the 'Frequency', 'Day' and Time 'you want the computer to automatically defragment the disks

Step 11. Select the 'OK' button and then the 'Close' button
The Disk Defragmenter utility will be closed, and your computer will be automatically defragmented with the specified frequency, activating on the specified day and time.
Method 2 of 2: Defragment Windows XP

Step 1. Go to the 'Start' menu and select the 'My Computer' item

Step 2. Select the 'Local Disk' with the right mouse button
Choose the 'Properties' option, from the context menu that will appear.

Step 3. Select the 'Tools' tab and then press the 'Perform defrag' button
The 'Disk Defragmenter' program window will appear.

Step 4. Choose the disk you want to defragment, then hit the 'Analyze' button
The operating system will analyze the contents of the disk to determine if data defragmentation is required.

Step 5. Press the 'Defragment' button
The process may take anywhere from a few minutes to a few hours, depending on the fragmented state of the data stored on the drive.

Step 6. Press the 'Close' button to exit the Disk Defragmenter utility
Advice
For Windows Vista users, the computer will be defragmented automatically every week. If you want to change this setting, you will need to start the defragmentation utility and change the date and time of the scheduled defrag by following the steps listed in the 'Defragment Windows 7 and Windows 8' section
Warnings
- If the computer is not running when automatic disk defragmentation is scheduled, the system will not be defragmented. So make sure you leave your computer on at the right time. This way your system will automatically defragment.
- If your computer was registered in a network domain, you would need to enter the network administrator password to perform the defragmentation. Ask your network administrator for the password to be able to perform manual disk defragmentation.