MS-DOS and Windows command line format command

Updated: 12/30/2021 by Computer Hope
format command

The format command is used to erase information from a computer diskette or fixed drive.

Tip

Although the information appears to be erased, it is still possible for software recovery programs to recover information from a formatted drive. If you want to make sure no information can be recovered from a drive, use a software utility to ensure all data is erased and overwritten. See: How to make sure all data is erased on a computer hard drive.

Availability

Format is an external command available for the following Microsoft operating systems as format.com.

Format syntax

Windows 10 and Windows 11 syntax

FORMAT volume [/FS:file-system] [/V:label] [/Q] [/L[:state]] [/A:size] [/C] [/I:state] [/X] [/P:passes] [/S:state]
FORMAT volume [/V:label] [/Q] [/F:size] [/P:passes]
FORMAT volume [/V:label] [/Q] [/T:tracks /N:sectors] [/P:passes]
FORMAT volume [/V:label] [/Q] [/P:passes]
FORMAT volume [/Q]
volume Specifies the drive letter (followed by a colon), mount point, or volume name.
/FS:filesystem Specifies the file system type (FAT, FAT32, exFAT, NTFS, UDF, ReFS).
/V:label Specifies the volume label.
/Q Performs a quick format. Note that this switch overrides /P.
/C NTFS only: Files created on the new volume will be compressed by default.
/X Forces the volume to dismount first if necessary. All opened handles to the volume would no longer be valid.
/R:revision UDF only: Forces the format to a specific UDF version (1.02, 1.50, 2.00, 2.01, 2.50). The default revision is 2.01.
/D UDF 2.50 only: Metadata will be duplicated.
/L[:state] NTFS Only: Overrides the default size of file record. By default, a non-tiered volume will be formatted with small-sized file records, and a tiered volume will be formatted with large-sized file records. /L and /L:enable forces format to use large-size file records, and /L:disable forces format to use small-sized file records.
/A:size Overrides the default allocation unit size. Default settings are strongly recommended for general use.
ReFS supports 4096, 64 K.
NTFS supports 512, 1024, 2048, 4096, 8192, 16 K, 32 K, 64 K, 128 K, 512 K, 1 M, 2 M.
FAT supports 512, 1024, 2048, 4096, 8192, 16 K, 32 K, 64 K, (128 K, 256 K for sector size > 512 bytes).
FAT32 supports 512, 1024, 2048, 4096, 8192, 16 K, 32 K, 64 K, (128 K, 256 K for sector size > 512 bytes).
exFAT supports 512, 1024, 2048, 4096, 8192, 16 K, 32 K, 64 K, 128 K, 256 K, 512 K, 1 M, 2 M, 4 M, 8 M, 16 M, 32 M.

Note that the FAT and FAT32 files systems impose the following restrictions on the number of clusters on a volume:

FAT: Number of clusters <= 65526
FAT32: 65526 < Number of clusters < 4177918

Format will immediately stop processing if it decides that the above requirements cannot be met using the specified cluster size.

NTFS compression is not supported for allocation unit sizes above 4096.
/F:size Specifies the size of the floppy disk to format (1.44).
/T:tracks Specifies the number of tracks per disk side.
/N:sectors Specifies the number of sectors per track.
/P:count Zero every sector on the volume. After that, the volume will be overwritten "count" times using a different random number each time. If "count" is zero, no additional overwrites are made after zeroing every sector. This switch is ignored when /Q is specified.
/S:state Specifies support for short file names (enable, disable). Short names are disabled by default.
/TXF:state Specifies txf is enabled/disabled (enabled, disabled). TxF is enabled by default.
/I:state ReFS only: Specifies whether integrity should be enabled on the new volume. "state" is either "enable" or "disable" Integrity is enabled on storage that supports data redundancy by default.
/DAX[:state] NTFS Only: Enable DAX (direct access storage) mode for this volume. In DAX mode, the volume is accessed via the memory bus, boosting IO performance. A volume can be formatted with DAX mode only if the hardware is DAX capable. State can specify "enable" or "disable." /DAX is considered as /DAX:enable.
/LogSize[:size] NTFS Only: Specifies the size for NTFS log file in kilobytes. The minimum supported size is 2 MB, so specifying a size smaller than 2 MB results in a 2 MB log file. Zero indicates the default value, which generally depends on the volume size.
/NoRepairLogs NTFS Only: Disables NTFS repair logs. If the flag is set, spotfix (i.e., chkdsk /spotfix) will not work.

Windows Vista, Windows 7, and Windows 8 syntax

FORMAT volume [/FS:file-system] [/V:label] [/Q] [/L] [/A:size] [/C] [/I:state] [/X] [/P:passes] [/S:state]
FORMAT volume [/V:label] [/Q] [/F:size] [/P:passes]
FORMAT volume [/V:label] [/Q] [/T:tracks /N:sectors] [/P:passes]
FORMAT volume [/V:label] [/Q] [/P:passes]
FORMAT volume [/Q]
volume Specifies the drive letter (followed by a colon), mount point, or volume name.
/FS:filesystem Specifies the file system (FAT, FAT32, exFAT, NTFS, UDF, ReFS).
/V:label Specifies the volume label.
/Q Performs a quick format. Note that this switch overrides /P.
/C NTFS only: Files created on the new volume will be compressed by default.
/X Forces the volume to dismount first if necessary. All opened handles to the volume would no longer be valid.
/R:revision UDF only: Forces the format to a specific UDF version (1.02, 1.50, 2.00, 2.01, 2.50). The default revision is 2.01.
/D UDF 2.50 only: Metadata will be duplicated.
/L NTFS Only: Use large-sized file records. By default, the volume will be formatted with small size file records.
/A:size Overrides the default allocation unit size. Default settings
are strongly recommended for general use.
ReFS supports 64 K.
NTFS supports 512, 1024, 2048, 4096, 8192, 16 K, 32 K, 64 K.
FAT supports 512, 1024, 2048, 4096, 8192, 16 K, 32 K, 64 K, (128 K, 256 K for sector size > 512 bytes).
FAT32 supports 512, 1024, 2048, 4096, 8192, 16 K, 32 K, 64 K, (128 K, 256 K for sector size > 512 bytes).
exFAT supports 512, 1024, 2048, 4096, 8192, 16 K, 32 K, 64 K, 128 K, 256 K, 512 K, 1 M, 2 M, 4 M, 8 M, 16 M, 32 M.

Note that the FAT and FAT32 files systems impose the following restrictions on the number of clusters on a volume:

FAT: Number of clusters <= 65526
FAT32: 65526 < Number of clusters < 4177918

Format will immediately stop processing if it decides that the above requirements cannot be met using the specified cluster size.

NTFS compression is not supported for allocation unit sizes above 4096.
/F:size Specifies the size of the floppy disk to format (1.44).
/T:tracks Specifies the number of tracks per disk side.
/N:sectors Specifies the number of sectors per track.
/P:count Zero every sector on the volume. After that, the volume will be overwritten "count" times using a different random number each time. If "count" is zero, no additional overwrites are made after zeroing every sector. This switch is ignored when /Q is specified.
/S:state Specifies support for short file names (enable, disable). Short names are disabled by default.
/I:state ReFS only: Specifies whether integrity should be enabled on the new volume. The "state" is either "enable" or "disable" Integrity is enabled on storage that supports data redundancy by default.

Microsoft Windows 2000 and Windows XP syntax

FORMAT volume [/FS:file-system] [/V:label] [/Q] [/A:size] [/C] [/X]
FORMAT volume [/V:label] [/Q] [/F:size]
FORMAT volume [/V:label] [/Q] [/T:tracks /N:sectors]
FORMAT volume [/V:label] [/Q] [/1] [/4]
FORMAT volume [/Q] [/1] [/4] [/8]
volume Specifies the drive letter (followed by a colon), mount point, or volume name.
/FS:filesystem Specifies the file system (FAT, FAT32, or NTFS).
/V:label Specifies the volume label.
/Q Performs a quick format.
/C Files created on the new volume will be compressed by default.
/X Forces the volume to dismount first if necessary. All opened handles to the volume would no longer be valid.
/A:size Overrides the default allocation unit size. Default settings are strongly recommended for general use.
NTFS supports 512, 1024, 2048, 4096, 8192, 16 K, 32 K, 64 K.
FAT supports 512, 1024, 2048, 4096, 8192, 16 K, 32 K, 64 K, (128 K, 256 K for sector size > 512 bytes).
FAT32 supports 512, 1024, 2048, 4096, 8192, 16 K, 32 K, 64 K, (128 K, 256 K for sector size > 512 bytes).

Note that the FAT and FAT32 files systems impose the below restrictions on the number of clusters on a volume:

FAT: Number of clusters <= 65526 FAT32: 65526 < Number of clusters < 268435446

Format will immediately stop processing if it decides that the above requirements cannot be met using the specified cluster size.

NTFS compression is not supported for allocation unit sizes above 4096.
/F:size Specifies the size of the floppy disk to format (160, 180, 320, 360, 640, 720, 1.2, 1.23, 1.44, 2.88, or 20.8).
/T:tracks Specifies the number of tracks per disk side.
/N:sectors Specifies the number of sectors per track.
/1 Formats a single side of a floppy disk.
/4 Formats a 5.25-inch 360 K floppy disk in a high-density drive.
/8 Formats eight sectors per track.

Microsoft Windows 2000 and Windows XP Recovery Console syntax

Formats a disk for use with Windows 2000.

format [drive:] [/q] [/fs:file-system]
drive: Specifies the drive to format.
/q Performs a quick format.
/fs:file-system Specifies the file system to use (FAT, FAT32, or NTFS).

Microsoft Windows 95, 98, ME syntax

Formats a disk for use with MS-DOS.

FORMAT drive: [/V[:label]] [/Q] [/F:size] [/B | /S] [/C]
FORMAT drive: [/V[:label]] [/Q] [/T:tracks /N:sectors] [/B | /S] [/C]
FORMAT drive: [/V[:label]] [/Q] [/1] [/4] [/B | /S] [/C]
FORMAT drive: [/Q] [/1] [/4] [/8] [/B | /S] [/C]
/V[:label] Specifies the volume label.
/Q Performs a quick format.
/F:size Specifies the size of the floppy disk to format (such as 160, 180, 320, 360, 720, 1.2, 1.44, 2.88).
/B Allocates space on the formatted disk for system files.
/S Copies system files to the formatted disk.
/T:tracks Specifies the number of tracks per disk side.
/N:sectors Specifies the number of sectors per track.
/1 Formats a single side of a floppy disk.
/4 Formats a 5.25-inch 360 K floppy disk in a high-density drive.
/8 Formats eight sectors per track.
/C Tests clusters that are currently marked "bad."

Format examples

Caution

When using the format command, remember all the information on the drive you want to format will be erased entirely.

format a:

Would erase all the contents off a floppy disk. Commonly used on an unformatted diskette or one you want to erase.

format a: /q

Quickly erases all the contents of a floppy diskette. Commonly used to erase all information on the diskette quickly.

format c:

Erase the contents of your C: hard drive. In other words, unless you want to erase all your computer's information, this command should not be executed unless you're planning on starting over.

Note

If you're in Windows or files on the hard drive are in use, this command will not work. If you want to format the primary hard drive, you'll need to boot from a bootable diskette, restore disc, or another bootable drive.