How to Format a Hard Drive Using the Command Prompt
Last Updated :
23 Jul, 2025
Formatting a hard drive is a common step when setting up a new disk or repurposing an old one. Although there are various methods to format in Windows, using the Command Prompt offers a fast and efficient option, particularly for advanced users.
This article will show you how to format a hard drive using Command Prompt, giving you step-by-step instructions to ensure the process is done safely and effectively. Whether you're dealing with an internal HDD, an external drive, or a USB stick, formatting a hard drive in CMD is a useful skill to have.
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

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

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.

Conclusion
Formatting a hard drive using Command Prompt is a straightforward process that gives you more control over your disk management tasks. By following the steps outlined in this guide, you can confidently format a hard drive in Windows CMD, preparing your drive for new data or wiping it clean. Whether you're troubleshooting, setting up a new drive, or simply clearing space, knowing how to format a disk using CMD is an essential tool in any Windows user's toolkit.
Similar Reads
How to Shut Down a Computer using Command Prompt? Shutting down your computer via the Command Prompt is a useful method that can help you perform a clean shutdown without having to use the standard Windows interface. Below are the steps to guide you through the process, along with some variations for advanced shutdown options.Table of Content1. Bas
5 min read
How to Format a Hard Drive in Windows? Formatting a hard drive in Windows is a crucial task that prepares the drive for data storage, resolves system errors, and clears unwanted data. Whether you're setting up a new hard drive, cleaning an old one, or solving file system issues, knowing how to format your drive correctly is essential. Th
4 min read
How to Use Command Prompt - Windows Command Prompt Guide Learn how to manually run the Command Prompt in different versions of Windows - The Windows Command Prompt (CMD) is a powerful tool that allows users to execute commands, automate tasks, and troubleshoot system issues efficiently. Whether youâre a beginner looking to learn basic CMD commands or an a
5 min read
How to Format a WriteâProtected Pen Drive? When you receive the error "The disk is write-protected", it means you tried formatting your Pendrive but were not able to. This may be due to external software or encryption that was probably used to lock the contents of the Pendrive and the contents within the drive are read-only. In this case, th
3 min read
How to Delete a File or Folder Using CMD When working with files on Windows, File Explorer usually makes creating and deleting files simple. But what if File Explorer freezes or stops responding? In such cases, the Command Prompt (CMD) offers a reliable alternative. CMD allows you to create and delete files or folders using simple commands
4 min read
How to Clear the Windows Command Prompt Screen If you've been working in the Windows Command Prompt and your screen is cluttered with text, knowing how to clear the Windows Command Prompt screen can make your workspace much tidier and easier to manage. This simple task can help you focus on the commands you're working on without distraction. In
6 min read