How to Format a Disk or USB Drive Using Command Prompt in Windows

Formatting a disk or USB drive using the Windows Command Prompt is a quick and efficient way to erase data or fix file system errors. This guide walks you through each step of formatting a drive via Command Prompt in Windows.

Step 1: Open Command Prompt as Administrator

To start, open Command Prompt with administrator privileges. Here’s how:

  1. Press Win + S and type cmd into the search bar.
  2. Right-click on Command Prompt and select Run as administrator.

Step 2: Launch Diskpart Utility

We’ll use the built-in Diskpart utility to format the drive:

  1. In Command Prompt, type diskpart and press Enter.
  2. This opens the Diskpart interface, which allows you to manage disks on your computer.

Step 3: Select the Disk

Next, choose the disk you want to format by following these steps:

  1. Enter list disk and press Enter to display a list of all available disks on your system.
  2. Identify the disk by its size, then type select disk X, replacing X with the disk number you want to format.

Step 4: Clean the Disk (Optional)

If you’d like to fully wipe the disk before formatting, use the following command:

clean

Press Enter after typing the command. Clean erases all data on the selected disk, so proceed carefully.

Step 5: Create and Activate a Partition

After cleaning the disk, create a new partition and set it as active:

create partition primary
select partition 1
active

These commands will create a primary partition and make it active.

Step 6: Format the Disk

Now you can format the disk by entering the following command:

format fs=ntfs quick

This command will format the drive to the NTFS file system. To use a different file system, replace ntfs with exfat or fat32. The quick option performs a fast format, only removing the file structure.

Step 7: Assign a Drive Letter

After formatting, assign a letter to the drive:

assign letter=X

Replace X with your preferred drive letter.

Exit Diskpart

Once completed, type exit to close Diskpart, and then exit again to close the Command Prompt.