Learn how to format a USB drive using CMD with DiskPart. Follow step-by-step instructions to choose FAT32, NTFS, or exFAT, recover important files before formatting, and explore alternative USB formatting methods in Windows.
Windows provides built-in command-line tools that let you format a USB drive, change its file system, or rebuild its partitions. You can use DiskPart to complete the process without installing additional software. However, formatting will erase existing data on the USB drive.
Recover Data Before Formatting a USB
Before formatting a USB drive, recover any important files you want to keep. If the USB is inaccessible, corrupted, or shows a RAW file system, use MiniTool Power Data Recovery to scan the drive and recover your data first.
Now, click the download button below to get MiniTool Power Data Recovery Free and use it to recover 1 GB of files from your USB drive for free.
MiniTool Power Data Recovery FreeClick to Download100%Clean & Safe
Step 1. Scan the USB Drive
Launch MiniTool Power Data Recovery Free and you will get its main interface. Your USB drive should be displayed under Logical Drives, along with a USB icon. Find it, move your cursor over it, and click the Scan button to start scanning for files.
If it is difficult to find the target USB partition here, you can go to the Devices tab next to Logical Drives and scan the whole USB disk.

Various factors can affect the scanning duration, and it is important to let the scan complete to ensure the best recovery results.
Step 2. Find and Preview Required Files
After the scan is complete, you can browse the scan results and locate the files you want to recover. By default, the found files are displayed according to their original folder structure under the Path tab. You can expand the folders and subfolders to find the specific files or directories you want to restore.
Alternatively, you can switch to the Type tab to view files by file type and format.
To help you quickly locate the files you need, the tool also provides two additional features:
- Filter: Narrow down the scan results by file type, file size, modification date, and file category.
- Search: Input part or all of the file name in the search box and press Enter to locate specific files instantly.

Step 3. Save the Needed Files
Select all the needed files, and click the Save button in the scan results window to save them all at once. A new window will pop up, prompting you to choose a safe location to store the recovered files.

How to Format a USB Using CMD
After rescuing your files, now you can learn how to format USB using CMD Windows 10/11.
How to Format USB Using Diskpart?
Step 1. In the Windows search box, type cmd. Then right-click Command Prompt from the best match result and select Run as administrator.
Step 2. In the Command Prompt window, type the following command lines, and press Enter after each command.
- diskpart
- list disk
- select disk * (* should be replaced with the USB disk number)
- list partition
- select partition * (* represents the number of the target partition on the USB drive)
- format fs=fat32 quick
Important: Before running select disk, check the disk number and capacity shown by list disk to make sure you have selected the correct USB drive. Selecting the wrong disk can cause data loss.

The following table explains what each DiskPart command does:
| Command | Purpose |
| diskpart | Opens the DiskPart utility. |
| list disk | Lists all disks connected to the computer. |
| select disk * | Selects the USB disk. Replace * with the correct disk number. |
| list partition | Lists the partitions on the selected USB disk. |
| select partition * | Selects the partition you want to format. |
| format fs=fat32 quick | Quickly formats the selected partition as FAT32. |
You can replace fat32 with ntfs or exfat depending on your needs. The quick parameter enables fast formatting, while omitting it performs a full format.
This is how to format a USB to FAT32 using CMD.
How to Clean and Format the USB Drive?
If you want to remove the existing partition information before formatting, you can use the DiskPart clean command.
After selecting the correct USB disk, run:
clean
Then create a new partition and format it:
create partition primary
format fs=fat32 quick
The clean command removes the existing partition and volume information from the selected disk. Use it carefully because the existing partitions will no longer be accessible. The clean all command goes further by writing zeros to every sector and takes significantly longer.

How to Format a Write-Protected USB Using CMD?
If you receive the “The disk is write protected” error, you need to remove the write protection of the USB drive and then format it with CMD.
In the administrative Command Prompt window, execute the following commands:
- diskpart
- list disk
- select disk * (replace * with the correct disk number)
- attributes disk clear readonly (It is used to clear the read-only attribute of your USB disk)
- list partition
- select partition * (replace * with the USB disk partition)
- format fs=fat32 quick
If clearing the read-only attribute does not work, the USB may have a physical write-protection switch, file system problem, or hardware failure.
Alternative Ways to Format USB Drives on Windows
As you can see, using CMD to format a USB drive is indeed an effective solution. However, the Diskpart tool lacks a visual interface, and if you are unfamiliar with diskpart commands, inputting the wrong disk number could lead to accidental disk formatting and permanent data loss.
If you prefer a safer and more user-friendly method, the following tools offer a great alternative to CMD for formatting your USB drive.
Format USB in File Explorer
Formatting a USB drive using File Explorer is one of the simplest and most user-friendly methods available on Windows. You can follow the steps below to complete it.
Step 1. Press Windows + E to open Windows Explorer.
Step 2. Go to the This PC section, right-click your USB drive, and choose Format.
Step 3. In the pop-up window, choose a file system from the drop-down menu, set up a volume label, tick the Quick Format option, and click Start.

Format USB in Disk Management
Disk Management is an important tool that allows you to view all connected drives, manage partitions, and format disks even if they do not display properly in File Explorer. So, if you are unable to format the USB drive in File Explorer, you can turn to this tool.
Step 1. Right-click the Start button on the taskbar and choose Disk Management.
Step 2. Right-click the disk partition and choose Format from the context menu.
Step 3. In the new window, set up the volume label, file system, and allocation unit size. Then, tick Perform a quick format, and click OK to start the formatting.

Format USB in MiniTool Partition Wizard
If Disk Management formatting gets stuck or some other error occurs during disk formatting, you can try the third-party USB format tool – MiniTool Partition Wizard. It provides a graphical alternative to DiskPart for formatting USB drives and managing partitions.
Download MiniTool Partition Wizard and use it to format your USB drive.
MiniTool Partition Wizard FreeClick to Download100%Clean & Safe
Step 1. Launch MiniTool Partition Wizard to get its home page. Select the USB disk partition and choose Format Partition from the right menu.
Step 2. In the next window, type a partition label, choose a file system, and click OK to start formatting.

Step 3. Once the formatting is done, preview the effect, and if it is satisfied, click Apply in the lower left corner to confirm.
Can You Repair a USB Without Formatting
In some cases, logical errors on a USB drive can be resolved without formatting. Tools like CHKDSK and Windows Error Checking can help repair the file system and regain access to your data. You may want to know them.
Use CHKDSK:
The CHKDSK utility is designed to detect and repair file system errors and locate bad sectors.
Step 1. Open a Command Prompt window as an administrator.
Step 2. Type chkdsk drive letter: /f /r /x and press Enter.
- Drive letter: You need to replace it with the actual drive letter of your USB drive.
- /f: Automatically repair errors on the USB stick.
- /r: Locate bad sectors and try to recover readable information.
- /x: Force unmount the drive if it is in use.
Use Error Checking Tool:
The Error Checking tool is the graphical version of CHKDSK, built into File Explorer for easy access. It is also used to scan and repair drive errors.
Step 1. Open File Explorer and go to the This PC section.
Step 2. Right-click the target USB stick and choose Properties.
Step 3. In the new window, go to the Tools tab, and click the Check button in the Error checking section.

Format USB CMD FAQ
Bottom Line
You can format a USB drive using CMD and DiskPart on Windows 10/11. Before formatting, recover or back up important files, then verify the correct USB disk with list disk. Choose FAT32, exFAT, or NTFS based on your needs.
If you prefer a graphical interface, File Explorer, Disk Management, or MiniTool Partition Wizard can also format a USB drive. Additionally, if you encounter issues while using MiniTool software, send emails to [email protected].


User Comments :