Need to format a USB drive with CMD? Recover important files first, then use DiskPart to format FAT32, NTFS, or exFAT, or choose an easier Windows method.

Can You Format a USB Using CMD

Yes. You can format a USB drive using Command Prompt on Windows with DiskPart. DiskPart lets you select a USB disk or partition and format it with file systems such as FAT32, NTFS, or exFAT.

However, formatting removes the files stored on the selected partition. If your USB contains important files, recover or back them up before formatting.

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 files from your USB drive.

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.

select the USB drive to scan in MiniTool Power Data Recovery

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. The Path view is ideal if you want to recover files with their original folder structure, while the Type view is better suited for recovering specific file types such as documents, photos, videos, and more.

view files by path and type in MiniTool Power Data Recovery

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.
the Filter and Search features in MiniTool Power Data Recovery

It is also worth noting that MiniTool Power Data Recovery offers a Preview feature. You can preview most file types without restrictions, and certain file types can be previewed up to 100 MB. Just double-click a file to open the preview window.

Step 3. Save the Needed Files

Click the Save button in the preview window to save the previewed file directly. Or, you can tick 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.

save the file in MiniTool Power Data Recovery

Once the recovery is completed, you can go to the selected directory to view and use the recovered files. Note that the recovery beyond 1 GB is not available in the free edition and requires an upgrade to the full edition.

Top Guide on How to Recover Data From Formatted USB Drive
Top Guide on How to Recover Data From Formatted USB Drive

This definitive guide introduces how to recover data from formatted USB drive with the best data recovery tool.

Read More

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.

format the disk with the FAT32 file system in Command Prompt

The following table explains what each DiskPart command does:

CommandPurpose
diskpartOpens the DiskPart utility.
list diskLists all disks connected to the computer.
select disk *Selects the USB disk. Replace * with the correct disk number.
list partitionLists the partitions on the selected USB disk.
select partition *Selects the partition you want to format.
format fs=fat32 quickQuickly 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.

clean and format the disk in Command Prompt

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.

Guide: Recover Deleted Videos From a USB Drive on Win & Mac
Guide: Recover Deleted Videos From a USB Drive on Win & Mac

This guide shows you how to recover deleted videos from a USB drive on Windows and Mac. It also covers tips to keep USB files safe.

Read More

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 the USB drive in File Explorer

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 the removable drive in Disk Management

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 left menu.

Step 2. In the next window, type a partition label, choose a file system, and click OK to start formatting.

format the disk partition in MiniTool Partition Wizard

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.

check the USB drive for file system errors in disk properties
How to Fix USB Drive Not Recognized: Full Guide in 2026
How to Fix USB Drive Not Recognized: Full Guide in 2026

Various solutions for you to fix the USB drive not recognized error and recover data from the not showing up/not working USB device.

Read More

Format USB CMD FAQ

Can I Format a USB Without Losing Data?
No. Formatting normally removes files from the selected partition. Back up or recover important data before formatting.
Which File System Is Best for a USB Drive?
FAT32 offers broad compatibility but has a 4 GB individual file-size limit. exFAT is better for large files and newer cross-platform devices, while NTFS is mainly suitable for Windows use
Why Is My USB Write Protected in DiskPart?
The USB may have a read-only attribute, a physical write-protection switch, file system problems, or hardware issues. You can first try attributes disk clear readonly in DiskPart.
Is DiskPart Safe for Formatting a USB?
Yes, if you select the correct disk and use the commands carefully. Always check list disk before running select disk, clean, or other commands that can affect the drive.

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].

  • linkedin
  • reddit