formatFORMAT Command Guide - Format Disks in Windows CMD
Master the format command to format hard drives, USB drives, and SD cards in Windows Command Prompt. Syntax, examples, file systems, and troubleshooting tips.
The format command is a Windows Command Prompt utility that prepares a disk partition for use by creating a new file system structure (NTFS, FAT32, exFAT, or FAT). It erases all existing data on the target volume and writes the necessary boot sector, file allocation table, and root directory structures required for the operating system to store and retrieve files.
Whether you're preparing a new hard drive for installation, formatting a corrupted USB flash drive, wiping a storage device clean before disposal, or converting between file system types, the format command gives you precise control over disk preparation that graphical tools cannot always match. System administrators and IT professionals rely on format for bulk device preparation, troubleshooting storage issues, and standardizing file systems across enterprise hardware deployments.
This comprehensive guide covers format command syntax, all major parameters and switches, file system options (NTFS, FAT32, exFAT), practical examples for common scenarios, troubleshooting common formatting errors, related disk management commands, and frequently asked questions. By the end, you'll confidently format drives from the command line for system administration, data management, and storage maintenance tasks.
What Is the Format Command?
The format command has been part of Windows (and MS-DOS before it) since the earliest versions of the operating system, making it one of the most fundamental disk management utilities available. It prepares a disk volume (hard drive partition, USB drive, SD card, or other removable media) for use by the operating system by creating a new file system.
When you format a drive, the command performs these operations:
- Writes a new boot sector to the beginning of the volume
- Creates file system structures (MFT for NTFS, FAT for FAT32/exFAT)
- Scans for bad sectors (full format only) and marks them as unusable
- Optionally zeroes out data for security purposes
The format command works in Command Prompt (CMD), Windows PowerShell, and Windows Terminal. It is available in all modern Windows versions including Windows 11, Windows 10, Windows 8, Windows 7, and Windows Server editions. Administrator privileges are required for formatting fixed (non-removable) drives.
Important: Formatting permanently destroys all data on the target volume. Always verify the correct drive letter before executing the command. Unlike del which removes file entries, format replaces the entire file system structure.
Format Command Syntax
The basic syntax for the format command is:
format volume [/fs:filesystem] [/v:label] [/q] [/a:size] [/c] [/x] [/p:count] [/s:state]
Parameters and Switches
| Parameter | Description |
|---|---|
volume | Drive letter followed by colon (e.g., D:) specifying the volume to format |
/fs:filesystem | File system type: NTFS, FAT32, exFAT, or FAT |
/v:label | Volume label (up to 32 characters for NTFS, 11 for FAT/FAT32) |
/q | Quick format—skips bad sector scan, only clears file system structures |
/a:size | Override default allocation unit size (cluster size) in bytes |
/c | NTFS only—enable file compression by default on new files |
/x | Force volume dismount before formatting (closes open handles) |
/p:count | Zero-fill every sector on the volume the specified number of passes |
/r:revision | Force UDF format to specified revision (UDF only) |
/d | UDF 2.50 only—duplicate metadata |
/l | NTFS only—use large FRS (File Record Segment) for large volumes |
/s:state | NTFS only—short filename support (enable or disable) |
If you omit the /fs parameter, format uses the current file system of the volume. If the volume has no existing file system, NTFS is used by default.
File System Options
NTFS (New Technology File System)
NTFS is the default and recommended file system for Windows internal drives. It supports file-level security (ACLs), encryption (EFS), compression, disk quotas, hard links, junction points, and volumes up to 256 TB. NTFS handles individual files up to 16 TB and maintains a transaction journal (MFT) for crash recovery.
Use NTFS for: Internal hard drives, SSDs, system partitions, data drives, and external drives used exclusively with Windows. NTFS is required for Windows system drives and BitLocker encryption.
Example:
format D: /fs:ntfs /v:DataDrive /q
FAT32 (File Allocation Table 32)
FAT32 is a legacy file system with broad compatibility across operating systems and devices. It supports volumes up to 32 GB (when formatted via Windows CMD) and individual files up to 4 GB. FAT32 lacks security features, encryption, and compression.
Use FAT32 for: USB flash drives under 32 GB, SD cards for cameras and embedded devices, and drives shared between Windows, macOS, and Linux. Note the 4 GB single-file limit.
Example:
format E: /fs:fat32 /v:USB_DRIVE /q
exFAT (Extended File Allocation Table)
exFAT bridges the gap between NTFS and FAT32, offering large file support (up to 16 EB theoretically) without the 4 GB file size limitation. It is optimized for flash storage and supported by Windows, macOS, Linux, and most modern consumer electronics.
Use exFAT for: USB flash drives over 32 GB, SD cards (SDXC standard), external drives shared between Windows and macOS, and media storage for cameras and drones.
Example:
format F: /fs:exfat /v:External /q
Practical Format Command Examples
Quick Format a USB Drive as FAT32
The most common formatting task—prepare a USB drive for universal compatibility:
format E: /fs:fat32 /v:MY_USB /q
Expected output:
The type of the file system is FAT32.
The new file system is FAT32.
QuickFormatting 16G
Creating file system structures.
Format complete.
16,027,396 KB total disk space.
16,027,360 KB are available.
Quick format takes seconds compared to minutes for a full format because it skips bad sector scanning.
Full Format an Internal Drive as NTFS
Perform a thorough format with bad sector scanning on a data partition:
format D: /fs:ntfs /v:DataDrive
A full format scans every sector on the disk, marking bad sectors as unusable. This is recommended for new drives, drives with suspected hardware issues, or drives that have been producing read/write errors.
Format a Drive with Custom Cluster Size
Optimize allocation unit size for specific workloads:
format D: /fs:ntfs /v:MediaDrive /a:64K /q
Larger cluster sizes (64K) improve performance for large files (video, database) but waste space for small files. Default NTFS cluster size is 4K for volumes under 16 TB.
Secure Wipe with Multiple Passes
Overwrite all sectors with zeros for data sanitization before hardware disposal:
format D: /fs:ntfs /p:3
The /p:3 parameter performs three pass zero-fill operations, meeting basic data sanitization standards. For compliance with DoD 5220.22-M, use /p:7. Note: secure wipe is extremely slow on large drives.
Format an SD Card as exFAT
Prepare an SDXC card for use in cameras, drones, or game consoles:
format G: /fs:exfat /v:CAMERA_SD /q
exFAT is the standard file system for SDXC cards (64 GB and larger), supporting files larger than 4 GB for 4K video recording.
Force Dismount Before Format
Format a volume that has open file handles or mapped connections:
format D: /fs:ntfs /v:DataDrive /q /x
The /x switch forces Windows to dismount the volume before formatting, automatically closing all open files and connections. Without /x, the format may fail with "volume is in use" errors.
Format with Compression Enabled
Enable NTFS compression for storage-constrained environments:
format D: /fs:ntfs /v:CompressedDrive /c /q
The /c switch enables default compression on the volume. All new files created on this drive will be automatically compressed. Compression saves disk space but adds CPU overhead during read/write operations.
Display Current Volume Information
Check the file system type and volume details before formatting:
vol D:
Or use fsutil fsinfo volumeinfo D: for detailed information including file system type, serial number, and feature flags.
Common Use Cases for the Format Command
-
Preparing new hard drives for use – New drives must be formatted before Windows can store files. Use
format D: /fs:ntfs /v:NewDrive /qto initialize a freshly partitioned drive with NTFS file system. -
Fixing corrupted USB flash drives – When a USB drive becomes unreadable or shows "RAW" file system, formatting restores a valid file system structure. Try
format E: /fs:fat32 /qto recover the drive. -
Converting between file systems – Change a FAT32 drive to NTFS or exFAT when the 4 GB file size limit is preventing file storage. Note: this is a destructive conversion (backup first).
-
Data sanitization before hardware disposal – Use
format D: /p:3or higher pass counts to overwrite data before retiring hard drives, meeting compliance requirements for data destruction policies. -
Troubleshooting disk errors and bad sectors – Full format (without
/q) scans and marks bad sectors, helping identify and isolate failing hardware before it causes data loss. -
Preparing bootable USB drives – Format the USB drive first (
format E: /fs:fat32 /q), then usebootsector other tools to make it bootable for Windows installation or recovery. -
Standardizing file systems across enterprise – IT departments format drives with consistent settings (file system, cluster size, volume label) using scripted format commands for hardware deployment.
-
Clearing malware-infected drives – When malware persists through normal cleaning, formatting eliminates all file system structures and malicious code. Use full format for thorough sanitization.
-
Optimizing drives for specific workloads – Database servers benefit from larger cluster sizes (64K NTFS), while general-purpose drives use default 4K clusters. Format with
/a:sizeto optimize. -
Preparing SD cards and memory cards – Digital cameras, game consoles, and IoT devices often require specific file systems. Use format to prepare cards in FAT32 or exFAT as required by the device.
-
Recovering from "disk not formatted" errors – When Windows prompts "You need to format the disk before you can use it," the format command provides control over file system selection and options.
-
Wiping personal data from shared computers – Before handing off a data drive, format removes all file system metadata, making casual data recovery significantly more difficult.
Tips and Best Practices
-
Always verify the drive letter – Double-check the target drive letter with
vol D:orwmic logicaldisk get name,size,descriptionbefore formatting. Formatting the wrong drive destroys all data permanently. -
Use quick format for routine operations – Quick format (
/q) completes in seconds and is sufficient for known-good drives. Save full format for new or suspect drives. -
Backup before formatting – Formatting is irreversible. Create complete backups of any important data before formatting, even if you believe the drive is empty.
-
Run as Administrator – Formatting fixed drives requires elevated privileges. Right-click Command Prompt and select "Run as administrator" before executing format commands.
-
Choose the right file system – Use NTFS for internal Windows drives, FAT32 for small USB drives with cross-platform needs, and exFAT for large external drives shared across operating systems.
-
Consider cluster size for performance – Default 4K clusters work for general use. Use 64K clusters for media servers, databases, or drives storing primarily large files.
-
Use /x to avoid "volume in use" errors – When formatting fails because files are open, add
/xto force volume dismount before formatting begins. -
Full format new drives once – Perform a full format (no
/q) on new drives to verify all sectors. Subsequent reformats can use quick format. -
Document formatting parameters – In enterprise environments, document the file system, cluster size, and volume label standards for consistent hardware deployment.
-
Don't format system drives from within Windows – You cannot format
C:(the system drive) while Windows is running from it. Use Windows installation media or recovery environment for system drive operations. -
Check drive health before formatting – Use
wmic diskdrive get statusor SMART monitoring tools to verify drive health before investing time in formatting a failing drive. -
Use /p for data sanitization compliance – Standard data wiping requires at least one pass (
/p:1). Security-sensitive environments may require 3-7 passes per organizational policy.
Troubleshooting Common Issues
"Cannot format this volume" Error
Problem: Format refuses to proceed with "Windows cannot format this volume" message.
Cause: The volume is the active system partition, is locked by another process, or has a file system that Windows cannot overwrite from the current session.
Solution:
- Use
/xparameter to force dismount:format D: /fs:ntfs /q /x - Close all applications using files on the target drive
- For system drives, boot from Windows installation media or recovery environment
- Check if BitLocker or other encryption is active on the volume
Prevention: Always close File Explorer windows and applications accessing the target drive before formatting.
"Access Denied" When Formatting
Problem: Format fails with "Access is denied" even when specifying a valid drive.
Cause: Insufficient permissions, write-protection on the device, or Group Policy restrictions preventing formatting.
Solution:
- Run Command Prompt as Administrator
- Check physical write-protect switch on USB drives and SD cards
- Verify Group Policy:
gpedit.msc→ Computer Configuration → Administrative Templates → System → Removable Storage Access - Use
diskpartto clean the drive first:select disk N→clean→create partition primary→ then format
Prevention: Always run CMD as Administrator for disk management operations.
Format Hangs or Takes Extremely Long
Problem: Full format appears stuck at a certain percentage and doesn't progress.
Cause: The drive has bad sectors that require extensive scanning, or the drive is physically failing and causing read/write timeouts.
Solution:
- Allow additional time—full format on large drives can take hours
- If truly stuck, press Ctrl+C to cancel, then try quick format (
/q) - Run
chkdsk D: /rfirst to identify and repair bad sectors - Check SMART data with
wmic diskdrive get statusto assess drive health - Consider replacing the drive if bad sector count is high
Prevention: Monitor drive health regularly with SMART tools. Use quick format for known-good drives.
"The format did not complete successfully"
Problem: Format starts but fails before completion with a generic error.
Cause: Corrupted partition table, hardware connection issues, driver problems, or the volume has unresolvable errors.
Solution:
- Use
diskpartto delete and recreate the partition:clean→create partition primary→format fs=ntfs quick - Try a different USB port or cable for external drives
- Update storage controller drivers
- Test the drive on another computer to rule out port/controller issues
Prevention: Ensure stable power and data connections before formatting. Use quality USB cables for external drives.
Wrong File System After Format
Problem: Drive shows unexpected file system type after formatting.
Cause: The /fs parameter was omitted, causing format to use the existing file system type, or the volume size exceeds FAT32 limits.
Solution:
- Always specify file system explicitly:
format D: /fs:ntfs /q - FAT32 is limited to 32 GB via Windows format command. Use exFAT for larger volumes
- Verify with
fsutil fsinfo volumeinfo D:after formatting
Prevention: Always include the /fs: parameter in format commands to ensure the intended file system is created.
Related Commands
diskpart – Advanced Disk Partitioning
While format prepares a volume's file system, diskpart manages disk partitions, volume creation, and disk configuration at a lower level. Use diskpart to create, resize, or delete partitions before formatting. diskpart's clean command removes all partition and volume information from a disk.
When to use diskpart: Creating new partitions, cleaning disks completely, extending volumes, or when format fails due to partition issues.
chkdsk – Check Disk Integrity
chkdsk verifies file system integrity and repairs errors on existing volumes. Use chkdsk to diagnose and fix disk problems before or after formatting. While format creates a new file system, chkdsk repairs an existing one.
When to use chkdsk: Before formatting to assess drive health, or as an alternative to formatting when you want to preserve data while fixing errors.
convert – Non-Destructive File System Conversion
convert changes a FAT/FAT32 volume to NTFS without destroying existing data. Unlike format, convert preserves all files and folders during the conversion process.
When to use convert: Upgrading FAT32 to NTFS without data loss. Note: conversion from NTFS back to FAT32 requires formatting.
label – Change Volume Labels
label creates, changes, or deletes the volume label (descriptive name) of a disk. While format sets the label during formatting with /v:, label changes the label on existing formatted volumes.
When to use label: Renaming drives without reformatting.
vol – Display Volume Information
vol displays the volume label and serial number for a specified drive. Use before formatting to verify the correct target drive.
When to use vol: Quick verification of drive identity before performing destructive operations like format.
Frequently Asked Questions
What does the format command do?
The format command prepares a disk volume for use by creating a new file system structure (NTFS, FAT32, exFAT, or FAT). It writes a new boot sector, creates file allocation tables, and optionally scans for bad sectors. Formatting permanently erases all existing data on the target volume.
How do I format a USB drive using CMD?
Open Command Prompt as Administrator, then use format E: /fs:fat32 /v:MY_USB /q (replace E: with your USB drive letter). Use fat32 for drives under 32 GB with cross-platform compatibility, or exfat for larger drives. The /q flag performs a quick format.
What is the difference between quick format and full format?
Quick format (/q) only clears the file system structures (file tables) and takes seconds. Full format (without /q) additionally scans every sector on the disk for bad sectors, which can take minutes to hours depending on drive size. Use full format for new or suspect drives.
Can I format the C: drive from Command Prompt?
You cannot format the system drive (typically C:) while Windows is running from it. To format C:, boot from Windows installation media, a recovery drive, or a WinPE environment. The format command will refuse to format the active system partition from within Windows.
What file system should I use when formatting?
Use NTFS for internal Windows drives (supports security, compression, large files). Use FAT32 for USB drives under 32 GB shared with cameras and older devices (4 GB file limit). Use exFAT for external drives over 32 GB shared between Windows and macOS (no practical file size limit).
How do I securely wipe a drive with format?
Use the /p:count parameter to overwrite all sectors with zeros: format D: /fs:ntfs /p:3 performs three overwrite passes. For higher security, increase the pass count. Note: secure formatting is significantly slower than standard formatting—a 1 TB drive may take several hours.
Does formatting permanently delete files?
Quick format only clears file system metadata—original file data remains on disk and may be recoverable with data recovery tools. Full format overwrites sectors during bad sector scanning only. For permanent deletion, use /p:1 or higher to zero-fill all sectors, making recovery nearly impossible.
Why does format say "volume is in use"?
This error occurs when files on the target volume are open by applications, Windows services, or File Explorer. Solutions: close all applications using the drive, close File Explorer windows showing the drive, or add the /x switch to force volume dismount before formatting: format D: /fs:ntfs /q /x.
Can I format a drive larger than 32 GB as FAT32?
The Windows format command limits FAT32 to 32 GB volumes. For FAT32 on larger drives, use third-party tools. However, Microsoft recommends exFAT for volumes over 32 GB—it offers FAT32's cross-platform compatibility without the file size or volume limitations.
How do I format an SD card in CMD?
Insert the SD card, identify its drive letter with wmic logicaldisk get name,size, then format: format G: /fs:fat32 /v:SD_CARD /q for cards under 32 GB, or format G: /fs:exfat /v:SD_CARD /q for SDXC cards (64 GB and larger). Ensure the card's write-protect switch is not engaged.
What allocation unit size should I use?
Use the default (4K for NTFS) for general-purpose drives. Use 64K clusters for media storage drives (video, large files) or database servers to reduce overhead. Smaller clusters (512 bytes, 1K) waste less space for drives storing many small files but increase file system overhead.
Can I undo a format?
Quick format can sometimes be undone with data recovery software if no new data has been written. Full format with /p passes is irrecoverable. There is no built-in Windows command to "unformat" a drive. Always backup important data before formatting.
Quick Reference Card
| Command | Purpose | Example Use Case |
|---|---|---|
format D: /fs:ntfs /q | Quick format as NTFS | Prepare internal data drive |
format E: /fs:fat32 /q | Quick format as FAT32 | Prepare USB drive for universal compatibility |
format F: /fs:exfat /q | Quick format as exFAT | Prepare large external drive |
format D: /fs:ntfs /v:Label /q | Format with volume label | Name the drive during formatting |
format D: /fs:ntfs | Full format with bad sector scan | New drive or suspect drive verification |
format D: /fs:ntfs /a:64K /q | Format with custom cluster size | Optimize for large file storage |
format D: /fs:ntfs /p:3 | Secure wipe with 3 passes | Data sanitization before disposal |
format D: /fs:ntfs /q /x | Force dismount and format | Format volume with open handles |
format D: /fs:ntfs /c /q | Format with compression enabled | Space-constrained environments |
vol D: | Check volume label before format | Verify correct target drive |
Try the Format Command in Our Simulator
Practice the format command safely in our Windows Command Simulator. No installation required—run format, test different file system options, and explore formatting parameters in your browser without any risk to your actual drives. Perfect for learning, IT training, and testing command syntax before running on production hardware.
Visit the Commands Reference for a full list of supported Windows CMD commands, including disk management tools like diskpart, chkdsk, and convert.
Explore related command guides: defrag for disk optimization, label for volume management, and fsutil for advanced file system operations.
Check out our About page to learn more about Windows Command Simulator and our mission to make Windows command-line tools accessible to everyone.
Summary
The format command is an essential disk management utility in Windows Command Prompt for preparing storage devices with new file systems. It supports NTFS for internal Windows drives with full security and feature support, FAT32 for cross-platform USB drives under 32 GB, and exFAT for large external drives shared between operating systems.
Key parameters include /fs: for selecting the file system type, /q for quick format operations that skip bad sector scanning, /v: for assigning volume labels, /a: for custom allocation unit sizes, and /p: for secure multi-pass data wiping. The /x switch forces volume dismount when formatting encounters "volume in use" errors.
Common use cases range from preparing new hardware and fixing corrupted USB drives to data sanitization before hardware disposal and optimizing cluster sizes for specific workloads. System administrators rely on format for standardized hardware deployment and storage maintenance across enterprise environments.
Always verify the correct drive letter before formatting—the operation permanently destroys all data on the target volume. Run Command Prompt as Administrator for fixed drive operations, and use full format (without /q) on new or suspect drives to identify bad sectors. For non-destructive file system conversion from FAT32 to NTFS, consider the convert command instead.