Formatting a hard drive from the Command Prompt or Diskpart gives you precise control over the process, especially when the usual graphical tools fail or when you need to clean a drive completely. This guide walks you through both methods, from opening the right tools to verifying the result, and covers the common pitfalls and fixes.
What You’ll Need
- A Windows PC (Windows 10 or 11 recommended, but the steps work on Windows 7/8 too).
- Administrator access. You must be able to run Command Prompt as administrator.
- Backup of any data you want to keep. Formatting erases everything on the drive.
- The drive letter or disk number of the drive you intend to format. You can find this in File Explorer (This PC) or Disk Management.
- If you are formatting the system drive (where Windows is installed), you will need a Windows installation USB or recovery drive, because you cannot format the drive while Windows is running from it.
Step-by-Step
Method 1: Using the Format Command (Quick and Simple)
- Open Command Prompt as administrator. Press the Windows key, type
cmd, right-click on “Command Prompt” and choose “Run as administrator”. Accept the UAC prompt. - Identify the drive letter. In the Command Prompt, type
wmic logicaldisk get deviceid, volumename, sizeand press Enter. Note the drive letter (e.g., D:) of the drive you want to format. Double-check you have the correct one. - Run the format command. Type the following and press Enter:
format D: /FS:NTFS /Q
ReplaceD:with your drive letter./FS:NTFSsets the file system to NTFS (useFAT32orexFATif needed)./Qperforms a quick format. Omit/Qfor a full format, which scans for bad sectors and takes much longer. - Confirm the prompt. You will see a warning: “Insert new disk for drive D: and press ENTER when ready…” Press Enter.
- Enter a volume label (optional). Type a name for the drive (e.g., “Backup”) and press Enter, or just press Enter to leave it blank.
- Wait for completion. The command will show progress. When it finishes, you will see “Format complete.”
Method 2: Using Diskpart (More Control, Clean and Format)
- Open Command Prompt as administrator as described above.
- Launch Diskpart. Type
diskpartand press Enter. You will see the DISKPART prompt. - List the disks. Type
list diskand press Enter. Note the disk number (e.g., Disk 1) of the drive you want to format. Be extremely careful: selecting the wrong disk can wipe your entire system. - Select the disk. Type
select disk 1(replace 1 with the correct number) and press Enter. You should see “Disk 1 is now the selected disk.” - Clean the disk (optional but recommended). Type
cleanand press Enter. This removes all partitions and data, making the disk completely unallocated. This is a full wipe and cannot be undone. - Create a partition (if you cleaned). Type
create partition primaryand press Enter. - Select the partition. Type
select partition 1and press Enter. - Format the partition. Type
format fs=ntfs quickand press Enter. Replacentfswithfat32orexfatas needed. Omitquickfor a full format. - Assign a drive letter. Type
assignand press Enter. This gives the drive a letter so it appears in File Explorer. - Exit Diskpart. Type
exitand press Enter.
Common Mistakes
- Choosing the wrong drive or disk. The most serious mistake. In Diskpart, using
select diskwith the wrong number will wipe that entire disk. Always verify the disk number and size before proceeding. - Formatting the system drive while Windows is running. Windows will not allow you to format the drive that contains the operating system. You must boot from a recovery drive or installation media.
- Using the wrong file system. NTFS is best for Windows system drives and large files. FAT32 has a 4GB file size limit. exFAT is good for external drives used with other devices. Choose based on your needs.
- Forgetting to back up. Formatting erases everything. There is no simple undo.
- Interrupting the format. Closing the Command Prompt or unplugging the drive during a full format can leave the drive in an inconsistent state. Let it finish.
Tips
- Use quick format when possible. A quick format only removes the file system structure, making the drive appear empty. It is much faster and sufficient for most cases. A full format is only needed if you suspect bad sectors or want to securely erase data (though it is not a secure erase).
- Check the drive letter in File Explorer first. Open “This PC” and note the exact drive letter and its size to avoid mistakes.
- For external drives, use exFAT. If you use the drive with both Windows and Mac or game consoles, exFAT is a good middle ground.
- Use Diskpart’s
list volumecommand. It shows all volumes with their drive letters and file systems, which is helpful for verification. - After formatting, check the drive health. Run
chkdsk D: /f(replace D:) to check for errors, especially after a full format.
Troubleshooting
- “Access is denied” error. You are not running Command Prompt as administrator. Right-click and select “Run as administrator”.
- “The disk is write-protected.” This often happens with SD cards or USB drives that have a physical lock switch. Check the side of the device. If no switch, use
diskpartand runattributes disk clear readonlyafter selecting the disk. - “Cannot format because the disk is in use.” Some program is using the drive. Close any open files or windows from that drive. If it still fails, try in Safe Mode or use Diskpart’s
cleancommand first. - Format fails with “The volume is too big for FAT32.” FAT32 has a 2TB limit and a 4GB file size limit. Use NTFS or exFAT instead.
- Diskpart says “Diskpart is unable to clean the disk.” This can happen if the disk is offline. In Diskpart, type
select disk X, thenonline disk, and trycleanagain. - After formatting, the drive does not appear in File Explorer. You may have forgotten to assign a drive letter. In Diskpart, select the volume and type
assign.
Frequently Asked Questions
Will formatting a hard drive permanently delete all data?
Formatting removes the file system and marks the space as available, but the actual data remains on the disk until overwritten. For sensitive data, use a tool that overwrites the drive with zeros or use Diskpart’s clean all (which takes much longer).
What is the difference between quick format and full format?
A quick format simply creates a new file system and removes the old one, taking seconds. A full format also scans the entire disk for bad sectors and writes zeros to every sector, which takes much longer and is more thorough.
Can I format the C: drive from Command Prompt?
No, not while Windows is running. You must boot from a Windows installation USB or recovery drive, open Command Prompt from the repair options, and then use Diskpart to format the system drive.
What file system should I choose?
For a Windows system drive, NTFS. For external drives used with multiple devices (like TVs or game consoles), exFAT. For very small drives (under 4GB) and compatibility with older devices, FAT32.
Is it safe to use Diskpart?
Yes, if you are careful. The danger is selecting the wrong disk. Always double-check the disk number and size before running clean or format. Once you wipe the wrong disk, the data is gone.
How long does a full format take?
It depends on the drive size and speed. A 1TB HDD can take several hours, while an SSD might take 30 minutes to an hour. A quick format takes less than a minute.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- Clone a Hard Drive That Won’t Boot: Full Guide
- How to Sign in to Third-Party Apps with Your Apple ID
- Phone Link Not Working? Fix Android & iPhone Issues
- Gboard Not Working on iPhone? 8 Fixes That Actually Work
- Fix Unable to Start the Bluetooth Stack Service
- Destiny 2 Connection Error Codes: Step-by-Step Fix