Format Command

Format Command Examples, Options, Switches, and More

Screenshot of the format command in Windows 10 Command Prompt
Format Command (Windows 10).

The format command is a Command Prompt command used to format a specified partition on a hard drive (internal or external), flash drive, or floppy disk to a specified file system.

Note: You can also format drives without using a command. See How to Format a Hard Drive in Windows for instructions.

Format Command Availability

The format command is available from within the Command Prompt in all Windows operating systems including Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP, and older versions of Windows as well.

However, the format command is only useful from within Windows if you're formatting a partition that can be shut down, or in other words, one that isn't currently dealing with locked files (since you can't format files that are in use). See How to Format C if that's what you need to do.

Beginning in Windows Vista, the format command performs a basic write zero hard drive sanitization by assuming the /p:1 option when executing the format command. This is not the case in Windows XP and earlier versions of Windows. See How to Wipe a Hard Drive for various ways to completely erase a hard drive, no matter what version of Windows you have.

The format command can also be found in the Command Prompt tool that's available in Advanced Startup Options and System Recovery Options. It's also a DOS command, available in most versions of MS-DOS.

Note: The availability of certain format command switches and other format command syntax may differ from operating system to operating system.

Format Command Syntax

format drive: [/q] [/c] [/x] [/l] [/fs:file-system] [/r:revision] [/d] [/v:label] [/p:count] [/?]

Tip: See How to Read Command Syntax if you're not sure how to read the format command syntax above or described in the table below.

drive:This is the letter of the drive/partition that you want to format.
/qThis option will quick format the drive, meaning it will be formatted without a bad sector search. I do not recommend doing this in most situations.
/cYou can enable file and folder compression using this format command option. This is only available when formatting a drive to NTFS.
/xThis format command option will cause the drive to dismount, if it has to, before the format.
/lThis switch, which only works when formatting with NTFS, uses large size file records instead of small size ones. Use /l on dedupe-enabled drives with files greater than 100 GB or risk an ERROR_FILE_SYSTEM_LIMITATION error.
/fs:file-systemThis option specifies the file system you want to format the drive: to. Options for file-system include FAT, FAT32, exFAT, NTFS, or UDF.
/r:revisionThis option forces the format to a specific version of UDF. Options for revision include 2.50, 2.01, 2.00, 1.50, and 1.02. If no revision is specified, 2.01 is assumed. The /r: switch can only be used when using /fs:udf.
/dUse this format switch to duplicate metadata. The /d option only works when formatting with UDF v2.50.
/v:labelUse this option with the format command to specify a volume label. If you don't use this option to specify a label, you'll be asked to after the format is complete.
/p:countThis format command option writes zeros to every sector of the drive: once. If you specify a count, a different random number will be written to the entire drive that many times after the zero writing is complete. You can not use the /p option with the /q option. Beginning in Windows Vista, /p is assumed unless you use /q [KB941961].
/?Use the help switch with the format command to show detailed help about the command's several options, including ones I did not mention above like /a, /f, /t, /n, and /s. Executing format /? is the same as using the help command to execute help format.

There are some other less commonly used format command switches too, like /A:size which lets you choose a custom allocation unit size, /F:size which specifies the size of the floppy disk that's to be formatted, /T:tracks which specifies the number of tracks per disk side, and /N:sectors which specifies the number of sectors per track.

Tip: You can output any results of the format command to a file using a redirection operator with the command. See How to Redirect Command Output to a File for help or check out Command Prompt Tricks for even more tips.

Format Command Examples

format e: /q /fs:exFAT

In the above example, the format command is used to quick format the e: drive to the exFAT file system.

Note: To adopt this above example for yourself, switch out the letter e for whatever your drive's letter is that needs formatted, and change exFAT to be whatever file system you want to format the drive to. Everything else written above should stay the exact same to perform the quick format.

format g: /q /fs:NTFS

Above is another example of the quick format command to format the g: drive to the NTFS file system.

format d: /fs:NTFS /v:Media /p:2

In this example, the d: drive will have zeros written to every sector on the drive twice (because of the "2" after the "/p" switch) during the format, the file system will be set to NTFS, and the volume will be named Media.

format d:

Using the format command without switches, specifying only the drive to be formatted, will format the drive to the same file system it detects on the drive. For example, if it was NTFS before the format, it will remain NTFS.

Note: If the drive is partitioned but not already formatted, the format command will fail and force you to try the format again, this time specifying a file system with the /fs switch.

Format Related Commands

In MS-DOS, the format command is often used after using the fdisk command.

Considering how easy formatting is from within Windows, the format command isn't often used in the Command Prompt in Windows.