How to Format a Hard Drive Using the Command Prompt
Last Updated :
05 Dec, 2025
Formatting a hard drive is a common process when setting up a new disk or repurposing an old one. While Windows provides multiple graphical tools to perform a format, advanced users often prefer the Command Prompt (CMD) for its speed, precision, and efficiency.
In this guide, you'll learn how to safely format any hard drive, SSD, USB flash drive, or external disk using Command Prompt.
Warning: Formatting a drive will erase all data on it. Double-check the disk number before proceeding.
Find the steps below to learn how to format a hard drive using a command prompt. In the section below, we have discussed all the steps in detail.
Step 1: Open Command Prompt
Open the Command Prompt as an administrator. Execute the 'diskpart' command in CMD. It will go inside the disk partition.
Command: diskpart

Step 2: Use Disk List Command
Now, let us see all the Windows Disk present on the device. Note down the Disk Number that should be formatted.
Command: list disk

Step 3: Select the Disk Number
Using the following command, select the disk that will be formatted.
Command: select disk <disk number>

Step 4: Use Clean Commnad
Now, use the simple command to Quick Clean the Drive.
Command: clean

Step 5: Create Primary Partition
Now, it is time to make the driver, the Primary Driver. It will help to reaccess the driver in the future for the OS installation process.
Command: create partition primary

As soon as the above step is complete, the File Explorer will prompt one window. Click on the Format Disk option to complete the process.

Explore
How To
MAC
AI Tools
Shortcut Key