Diskpart: The Command-Line Disk Partitioning Tool
Download nowDiskpart is a text-based command interpreter built into Windows for managing disks, partitions, and volumes — more powerful and more dangerous than the graphical Disk Management tool.
Updated August 9, 2026 · PC Utility Hub Editorial Team
Launching diskpart
Open an elevated Command Prompt or PowerShell window and type diskpart, then press Enter. This opens a separate DISKPART> prompt where all further commands are typed.
diskpartCore commands
| Command | Purpose |
|---|---|
| list disk | Shows all physical disks attached to the system |
| select disk N | Selects a disk by its number for further commands |
| list partition | Shows partitions on the selected disk |
| select partition N | Selects a partition |
| list volume | Shows all volumes with drive letters |
| clean | Erases the partition table on the selected disk |
| create partition primary | Creates a new primary partition |
| format fs=ntfs quick | Quick-formats the selected partition |
| assign letter=E | Assigns a drive letter |
| active | Marks the selected partition as active/bootable |
Why diskpart is riskier than Disk Management
Unlike Disk Management, diskpart won't ask 'are you sure' before a destructive command executes against the selected object — it trusts that you selected the right one.
Warning: diskpart operates on whatever disk or partition is currently 'selected' with no visual confirmation dialog. Running 'clean' or 'format' on the wrong selected disk destroys all data on it with no undo. Always run 'list disk' and confirm the disk number before selecting and modifying anything.
Common uses
- Creating or deleting partitions when Disk Management's GUI options are grayed out.
- Cleaning a USB drive completely before creating a bootable installer.
- Extending or shrinking volumes from a script.
- Marking a partition active for dual-boot or bootable media setups.
- Converting a disk between MBR and GPT (using 'convert gpt' or 'convert mbr' — requires the disk to have no partitions).
diskpart vs Disk Management
Disk Management (diskmgmt.msc) is the graphical equivalent and is safer for routine tasks like resizing or formatting existing volumes, since it shows confirmation prompts and a visual disk map. diskpart is preferred for scripting, batch operations, and tasks the GUI doesn't expose, such as certain GPT/MBR conversions or working around a Disk Management bug.
Frequently asked questions
- Is diskpart safe to use?
- It's safe when you double-check the selected disk/partition before every destructive command. It has no confirmation prompts, so mistakes affect the wrong drive silently.
- Can diskpart recover a deleted partition?
- No, diskpart creates and deletes partitions but doesn't recover data. Use a file recovery tool if you deleted a partition by mistake and need the data back.
- How do I exit diskpart?
- Type exit at the DISKPART> prompt to return to the regular command line.
Related pages
- Diskpart Clean & Format USBCommands to safely wipe and reformat a USB flash drive with diskpart.
- Disk Utility (Disk Management)How to open and use Windows' Disk Management, the graphical disk utility.
- CHKDSKOverview of the chkdsk utility, its switches, and how it fits into Windows disk maintenance.
- File Recovery ToolsHow file/data recovery utilities work on Windows and how to choose one.