Formatting an SD card is a common task when preparing it for use in a camera, smartphone, gaming console, Raspberry Pi, or Windows PC. While most users rely on File Explorer or Disk Management, you can also format an SD card using Command Prompt (CMD). This method is particularly useful when the SD card won’t format normally, displays file system errors, or is not accessible through the graphical interface.
Windows includes the powerful DiskPart utility, which allows you to manage disks, partitions, and storage devices directly from the command line. Using DiskPart, you can clean an SD card, create a new partition, and format it in the desired file system such as FAT32, exFAT, or NTFS.
In this guide, you’ll learn several methods to format an SD card using CMD in Windows 11, Windows 10, Windows 8, and Windows 7, along with important precautions and troubleshooting tips.
What Happens When You Format an SD Card?
Formatting removes the existing file system and prepares the SD card for storing new data. Depending on the format type, Windows may simply erase the file allocation table (Quick Format) or scan the storage for bad sectors while completely erasing the data (Full Format).
Formatting an SD card can help:
- Remove viruses and malware.
- Fix file system corruption.
- Resolve “SD card not recognized” errors.
- Clear all existing files.
- Prepare the card for another device.
- Change the file system.
- Improve compatibility with different operating systems.
Important: Formatting permanently removes stored data. Back up any important files before proceeding.
Method 1: Format an SD Card Using DiskPart (CMD)
DiskPart is Microsoft’s built-in disk management utility.
Step 1: Open Command Prompt as Administrator
- Press the Windows key.
- Type cmd.
- Right-click Command Prompt.
- Select Run as administrator.
Step 2: Launch DiskPart
Type:
diskpart
Press Enter.
The prompt changes to:
DISKPART>
Step 3: List All Connected Disks
Enter:
list disk
DiskPart displays all storage devices connected to your computer.
Carefully identify your SD card by checking its storage capacity.
Step 4: Select the SD Card
Replace X with your SD card’s disk number.
select disk X
Example:
select disk 2
DiskPart confirms that the disk has been selected.
Step 5: Clean the SD Card
Type:
clean
Press Enter.
This removes the partition information from the SD card.
Step 6: Create a New Partition
Run:
create partition primary
Step 7: Select the New Partition
Type:
select partition 1
Step 8: Format the SD Card
For FAT32:
format fs=fat32 quick
For exFAT:
format fs=exfat quick
For NTFS:
format fs=ntfs quick
Wait until formatting reaches 100%.
Step 9: Assign a Drive Letter
Run:
assign
Finally, exit DiskPart:
exit
Your SD card is now ready for use.
Method 2: Format an SD Card Using the Format Command
If the SD card already has a drive letter, you can use the standard Windows Format command.
Open Command Prompt as Administrator.
Type:
format E: /FS:FAT32
Replace E: with your SD card’s drive letter.
You can also use:
format E: /FS:exFAT
or
format E: /FS:NTFS
Follow the on-screen prompts to complete the formatting process.
Method 3: Perform a Full Format Using CMD
A full format scans for bad sectors and takes longer than a quick format.
Example:
format E: /FS:FAT32
Notice that the quick option is omitted.
Windows checks the entire SD card before completing the format.
A full format is recommended if you suspect storage corruption.
Method 4: Format an SD Card as exFAT
exFAT is ideal for SDXC cards larger than 32 GB.
Using DiskPart:
format fs=exfat quick
Using Command Prompt:
format E: /FS:exFAT /Q
exFAT supports large individual files and is compatible with many modern devices.
Method 5: Format an SD Card as FAT32
FAT32 remains the most compatible file system for:
- Digital cameras
- Older smartphones
- Game consoles
- Raspberry Pi
- Embedded devices
Using DiskPart:
format fs=fat32 quick
Using Command Prompt:
format E: /FS:FAT32 /Q
Windows may not allow formatting drives larger than 32 GB as FAT32 using built-in tools.
Method 6: Format an SD Card as NTFS
NTFS provides:
- Better security
- File permissions
- Compression
- Support for very large files
Format using:
format fs=ntfs quick
or
format E: /FS:NTFS /Q
NTFS is best suited for Windows computers rather than cameras or portable devices.
Method 7: Remove Write Protection Before Formatting
If CMD reports that the disk is write-protected, remove the protection using DiskPart.
Launch DiskPart:
diskpart
List disks:
list disk
Select your SD card:
select disk X
Remove the write protection:
attributes disk clear readonly
Now repeat the formatting process.
Also check whether your SD card adapter has a physical lock switch enabled.
Method 8: Check the SD Card Before Formatting
If the SD card contains file system errors, run Check Disk first.
Open Command Prompt as Administrator.
Type:
chkdsk E: /f
Replace E: with your SD card’s drive letter.
Windows repairs logical file system errors before formatting.
Method 9: Verify the Format Was Successful
After formatting:
- Open File Explorer.
- Locate your SD card.
- Right-click it.
- Choose Properties.
Verify:
- File system
- Capacity
- Used space
- Free space
You should also copy a few test files to ensure the card is functioning correctly.
Method 10: Safely Remove the SD Card
Once formatting is complete:
- Save any open files.
- Click the Safely Remove Hardware icon in the notification area.
- Select your SD card.
- Wait for the confirmation message.
- Remove the card from your computer.
Safely ejecting the card helps prevent file system corruption.
Which File System Should You Choose?
The best file system depends on how you plan to use the SD card.
FAT32 offers the widest compatibility with cameras, game consoles, media players, and older devices. However, it has a maximum file size limit of 4 GB.
exFAT is the best choice for SDXC cards and large-capacity storage. It supports files larger than 4 GB and works with most modern versions of Windows, macOS, Android, and many cameras.
NTFS is designed primarily for Windows PCs. It supports advanced features such as file permissions, encryption, compression, and large file sizes but may not be compatible with many cameras, smartphones, or other portable devices.
Common Formatting Errors and Solutions
You may encounter errors while formatting an SD card. Here are some common issues and possible fixes:
- The disk is write-protected: Remove the physical lock on the SD card adapter or clear the read-only attribute using DiskPart.
- Access is denied: Run Command Prompt as an administrator and ensure no files on the SD card are currently in use.
- The volume is in use: Close all applications accessing the SD card and try again.
- DiskPart has encountered an error: Disconnect and reconnect the SD card, then repeat the process.
- Windows was unable to complete the format: Run
chkdskfirst, or use thecleancommand in DiskPart before creating a new partition.
Conclusion
Formatting an SD card using CMD gives you greater control than the standard Windows formatting tools. Whether you use the DiskPart utility or the Format command, you can quickly erase the card, choose the appropriate file system, and prepare it for use with your PC, camera, smartphone, or other devices.
For most users, DiskPart is the most reliable method because it can remove corrupted partitions, recreate the partition table, and format the SD card from scratch. Just be sure to select the correct disk, as formatting permanently erases all data on the selected device.
Frequently Asked Questions
Can I format an SD card using Command Prompt?
Yes. Windows includes the DiskPart utility and the Format command, both of which can format SD cards.
Which file system is best for an SD card?
FAT32 is best for maximum compatibility, exFAT is recommended for SDXC cards and large files, and NTFS is ideal for Windows-only use.
Why won’t my SD card format?
Common reasons include write protection, file system corruption, bad sectors, or the card being in use by another application.
Does formatting permanently erase data?
Yes. Formatting removes the file system and makes existing data inaccessible. Although recovery may be possible in some cases, you should back up important files before formatting.


