Open In App

How to Format a Hard Drive Using the Command Prompt

Last Updated : 05 Dec, 2025
Comments
Improve
Suggest changes
2 Likes
Like
Report

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.

How to Format a Hard Drive Using Command Prompt

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

1--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

2--List-Disk

Step 3: Select the Disk Number

Using the following command, select the disk that will be formatted.

Command: select disk <disk number>

3--Select-The-Disk

Step 4: Use Clean Commnad

Now, use the simple command to Quick Clean the Drive.

Command: clean

4--Execute-Clean-Command

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

5--Make-Primary-Partition

Step 6: Format the Disk

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.

6--Click-Format-Disk


Explore