Formatting a USB using Command Prompt involves using the DiskPart utility. Since it is a command-line tool, you need to run the commands carefully to avoid mistakes. This MiniTool guide provides everything you need, including detailed instructions to format USB using CMD and the best alternative to do it easily.
Usually, formatting a USB flash drive can be done easily through Disk Management and File Explorer on Windows. Simply right-click the USB drive and choose the Format option. This method is quite simple and efficient.
However, sometimes the formatting procedure may get stuck or display strange error messages such as “Windows was unable to complete the format”.
These issues do occur in real situations. Here is an example:
“Hello. I am unable to format this 8 GB USB stick through Windows’ Disk Management, so I guess I’ll try CMD > DISKPART. Can someone walk me through the steps? I think I got most of it down, but want to make sure...”reddit.com
If you are in the same boat, Command Prompt offers a powerful way to format a USB drive. However, its command-line operations can be confusing for many users. So, we are writing this post to explain the exact steps clearly.
Why Do You Need to Format a USB Drive?
First, when should you format your USB flash drive?
There are some common situations in which you want to format your USB drive:
- To modify the file system.
- To quickly delete a large amount of data.
- To repair bad sectors and resolve flash drive corruption.
- When you want to make a bootable USB drive.
- When you need to eliminate viruses.
- Etc.
Formatting a USB drive via CMD can be applied in all of these scenarios. Follow the steps mentioned in the next section to learn how to format a USB flash drive using CMD.
Kind Reminder: Back Up Your USB Files
As formatting will delete all stored data on the USB flash drive, if your USB is available, ensure that you back up important data from the USB to a different secure location beforehand.
You can manually transfer them to a secure location on your PC using Windows Explorer.
Besides, you can use free backup software like MiniTool ShadowMaker to back up files from your USB drive to an external hard drive or network location.
MiniTool ShadowMaker TrialClick to Download100%Clean & Safe
However, if the pen drive has a corrupted file system or other logical issues, it may not appear in Windows Explorer.
In this scenario, consider utilizing a reliable data recovery software to retrieve data from it. Most third-party recovery tools can access your USB drive, even if it doesn’t appear in Windows Explorer.
Keep reading to get more details.
How to Format a USB Flash Drive Using CMD
For an intuitive guide, watch this video:
Windows has a built-in disk partitioning tool called DiskPart that can be accessed via the Command Prompt Utility.
It provides detailed information regarding the volumes and partitions, enables creation and deletion, and more.
To format a USB using CMD, follow these instructions:
Step 1. Connect the USB drive to your computer and make sure it is recognized successfully.
Step 2. Type CMD in the Start menu, right-click on Command Prompt, and select Run as Administrator.
Step 3. In the Command Prompt window, type the diskpart command and press Enter to run the DiskPart tool.

Step 4. Then, type the following commands and press Enter after each command.
- list disk: List all the disks in your system.
- select disk x: Replace x with your USB drive disk number. Ensure you select the correct disk number.
- clean: Delete all partitions on the USB drive.
- create partition primary
- format fs=ntfs quick: Format your USB drive to NTFS. Also, you can replace ntfs with fat32 or exfat to format it to FAT32 or exFAT.
- assign letter x: Replace x with an available letter to give the formatted partition a specific drive letter. Then you can access it from Windows File Explorer.

The Best Alternative for USB Flash Drive Formatting
While it’s possible to format a USB drive using CMD, this method is not very user-friendly for many beginners on Windows. Additionally, any mistakes could lead to data loss on other storage devices.
Therefore, we suggest you consider using a free alternative to Command Prompt, specifically the free partition manager tool, MiniTool Partition Wizard.
MiniTool Partition Wizardserves as an excellent alternative to CMD for formatting USB drives. This tool is suitable for users of all skill levels wanting to format their USB drives.
With its straightforward interface and accurate functionality, formatting a USB can be done easily within just a few clicks.
MiniTool Partition Wizard FreeClick to Download100%Clean & Safe
Let’s proceed to format your USB drive using this tool to restore the functionality of a RAW, inaccessible, unreadable, or even corrupted USB flash drive. Here are the detailed steps:
Step 1. Open this partition formatter to enter its main interface. Select the USB drive partition and then click the Format Partition option in the left panel.

Step 2. In the pop-up mini window, specify the partition label and the desired file system, and click the OK button.

Step 3. It will go back to the main interface. Next, click Apply in the lower left corner to commit the pending operation.

How to Recover Data from a Formatted USB Flash Drive (if Possible)
Have you just formatted your USB drive and are now concerned about the data you may have lost? The photos, cherished memories, and vital files that were on the USB drive are all missing?
Don’t worry; you still have the opportunity to recover files from a formatted USB flash drive using some surprisingly easy methods.
There are several ways to accomplish this, but the most reliable method we recommend is using professional data recovery software before you add new data that could overwrite the lost files.
MiniTool Power Data Recovery is a free data recovery tool that allows users to recover their important data even after a USB drive has been formatted, and the process is quite straightforward.
Key Features of MiniTool Power Data Recovery
- Compatible storage devices: USB drives, SD cards, hard disks, SSDs, CDs/DVDs.
- Compatible versions of Windows: Windows 11, 10, 8, and 8.1.
- Supported file formats: Photos, videos, audio files, documents, archives, etc.
- File deletion situations: Formatting, accidental deletion, virus attacks, file system damage, errors during file transfer, etc.
- File preview option: View documents, photos, videos, audio, and various other file types before recovery.
- Free recovery cap: Retrieve up to 1 GB of files without charge.
Now, download this MiniTool data recovery tool and give it a try. You can scan and preview your files, and recover up to 1 GB of files for free.
MiniTool Power Data Recovery FreeClick to Download100%Clean & Safe
Follow the steps below to scan the formatted USB flash drive and recover your files.
Step 1. Run the file restore software and enter the home page. Then, select your USB drive under Logical Drives or Devices and click the Scan button to start scanning for files.
- The Logical Drives module lists all existing, deleted, or lost partitions on your disks, with the USB flash drive partition indicated by a USB icon.
- The Devices module showcases physical disks connected to your computer, allowing you to locate and scan your USB by its name and storage capacity.

Step 2. Once the scanning is complete, you can start searching for the files you wish to restore.
By default, you will be in the Path category section. In this tab, you can find folders for Deleted Files, Lost Files, and Existing Files.
To locate the files you need easier, you can also take advantage of these features:
- Type: This section organizes all files according to their type and format rather than their original order. This feature is useful if you’re looking to recover a specific type of file, like photos, documents, or videos.
- Filter: This feature allows you to narrow down files based on criteria such as file type, last modified date, file size, and file category. You can use several filtering options simultaneously.
- Search: This allows you to conduct a specific search. Just type a complete or partial file name into the search bar located in the upper right corner and hit Enter.
- Preview: Select a file and click Preview to verify if it is the one you wish to recover. This feature allows you to view documents, photos, and videos during the scanning process to ensure accurate recovery.

Step 3. Tick all the files you want to recover, and then click the Save button. In the new window, choose a location to store the recovered files and click OK.

Final Thought
Reading here, you should know how to format USB using CMD. Carefully follow the instructions above to format your USB on Windows.
Additionally, you can use MiniTool Partition Wizard for a quicker and easier formatting process.
After formatting, you may look for a powerful data recovery tool to recover your lost data. If needed, you can follow the steps to try MiniTool Power Data Recovery.
Hope the information above can help you get everything back on track.
If you need any help with MiniTool’s products, please send an email to the support team via [email protected].
User Comments :