[2025] How to Format SD Card Using CMD in Windows 10/11?
Can you format SD card using CMD? Formatting an SD card becomes necessary if it shows signs of corruption or when you want to erase all data because you no longer need it.
There are many ways of formatting an SD card, but CMD is a powerful tool that can format the memory card without any problems by using a few simple commands. In this article, we’ll explain how you can format an SD card using CMD and what to do if you are unable to use CMD for formatting.
Things You Should Know Before Formatting SD Card
Formatting an SD card isn’t difficult, but doing it the wrong way can cost you your data or reduce the card’s lifespan. Here’s what you need to know beforehand.
What is an SD Card & How does it work?
An SD card is an external storage device used on laptops, mobile phones, digital cameras, and much more. The card offers ample storage space in a tiny body. It is also portable, so you can easily transfer data between various devices.
What is CMD & How does it work?
CMD is short for Command and refers to the in-built tool “Command Prompt” in Windows. It is a powerful tool that executes commands entered by a user for different functions. You can launch it by typing “cmd” in the Windows search bar.
When should you format an SD card?
There are two reasons why it becomes necessary to format an SD card. First, if it behaves abnormally and is not detected by the device. Secondly, if you want to delete the card data because you no longer need it.
How to Format SD Card Using CMD?
Below are the detailed steps on how to format an SD card with CMD:
- Open the “Windows Search bar.” Then enter “cmd.”
- A “Command Prompt” window will pop up, click "Run as administrator.
- Type
diskpart. Hit “Enter.” Next, enterlist disk. It will help identify the SD card from the list of disks. - Check your SD card disk number. Type
select diskfollowed by the specific disk number of your SD card. And select your SD card from the list. - Type
clean. It will delete everything from the SD card.
- Now you’ll have to create a new partition on the memory card. Type
create partition primary. Hit “Enter.”
- Next, type
format fs=fat32. Hit “Enter.” fs is short for the file system, and fat32 is the file format known as File Allocation Table. If you plan to save more than 4GB of files on the SD card, format it with the exFAT file system instead of fat32. - Assign a drive letter to your SD card for easy access from the File Explorer. Then type
assign letter f. (Instead of f, you can assign any letter of your liking)
What If I Cannot Format SD Card Using CMD?
Formatting an SD card through CMD is a strong and effective method, but it can still fail in certain situations. If you run into an error, the issues below are usually to blame. Here are the fixes you can try.
Case 1: The SD Card Is in Read-Only Status
“Read-only” refers to data or a device that can be viewed but not edited. If your SD card is in read-only mode, you can still open the files, but you won’t be able to save, delete, or change anything—because the card is write-protected. Below are two methods to turn off this read-only mode.
Slide the Physical Switch
The first method is simply to flip the physical switch on the card. Many memory cards include this feature by default. Check your card for a small slider and move it to disable the read-only mode.
Remove Write Protection
Another way to fix the issue is to disable write protection that was set through software. You can do this from a computer or with some mobile encryption apps.
Because a read-only SD card can’t be formatted, you may see an error when using CMD. If that happens, use the steps below to clear the write protection.
- Open the Windows Search bar in the lower-left corner, type "Command Prompt", and choose "Run as administrator".
- In the Command Prompt window, type
diskpartand press "Enter". - Next, type
list diskto display all available drives. - Type
select disk X, replacing X with the number of your SD card. - Enter
attributes disk clear read-onlyto remove the write protection.
- Wait for the process to finish. This command lifts the read-only restriction that prevents you from adding, deleting, or modifying files on the SD card.
Case 2: The File System Is Corrupted
Chkdsk, short for “Check Disk”, is one of the most useful tools available in Command Prompt. If your SD card has file system errors or bad sectors, the formatting process can fail. In these cases, running the chkdsk command is a good option.
- Connect the SD card to your PC. Find its drive letter in Windows Explorer.
- Open the “Windows Search bar” and enter “cmd.”
- A “Command Prompt” window will pop up. Run it as administrator.
- Type
chkdsk X: /f. Here X is the SD card drive letter, and f is a parameter that will fix issues in your SD card.
You can also assign a variety of parameters like f for different functions. These include: such as /p, for an extensive search. Or type /r to look for bad sectors and retrieve readable files from the SD card.
- /p: To perform an extensive search.
- /r: To look for bad sectors and retrieve readable files from the SD card.
- One common problem is file system errors on the memory stick. These can show up as corrupted entries in the SD card’s Master File Table (MFT), wrong timestamps, damaged security information, or incorrect file sizes for some files.
- Another issue is bad sectors. There are two kinds: soft and hard. Soft bad sectors happen when data is stored incorrectly, while hard bad sectors are physically damaged parts of the card. Running the chkdsk tool can fix soft bad sectors and mark hard ones so the system won’t use them.
Case 3: The SD Drive Letter Is Invisible
Formatting an SD card via CMD is impossible if your PC does not recognize its drive letter. You can fix this issue by using the Disk Management tool to change the drive letter of your SD card.
- In Windows, search for "Disk Management" in the Windows search bar and open it as an administrator.
- Then, right-click your SD card and choose "Change Drive Letter and Paths".
- Finally, assign a new drive letter and click "OK" to apply the change.
Case 4: The SD Card Is Infected with Virus
A virus infection or malware will make the SD card useless. Your PC might also be infected. So, before connecting your SD card to the PC for formatting, install a reliable antivirus program like AVG.
How to Recover Lost Files After Formatting SD Card?
Before formatting an SD card using CMD, it’s crucial to back up your data. Formatting erases everything on the card, so all files will be permanently lost. But if you skipped this step and suddenly realize that your important photos, videos, or documents are gone, don’t panic.
You can turn to Tenorshare 4DDiG, a trusted data recovery tool that can scan your SD card thoroughly and recover lost files even after formatting. It supports a wide range of file types and works with various storage devices including SD card, memory card, external hard drive, SSD..., making it a convenient solution for accidental data loss.
Secure Download
Secure Download
With 4DDiG, you can preview recoverable files before restoring them, so you only recover what you need. This makes it an ideal tool to safely retrieve data after formatting via CMD when dealing with unexpected file loss.
- Plug the SD card into your computer, open 4DDiG, select "SD Card" on the main screen, and click "Scan" to begin searching for lost files.
- 4DDiG will start scanning your SD card right away for all recoverable files, so be patient while it completes. Once the scan is finished, you can locate the files you want to restore using the search bar or by browsing the tree-view panel.
- Double-click any file to preview it. Then, choose the files you want to recover and click "Recover".
- After recovery, store the restored files in a secure location on your computer or on another external drive.
Common SD Card Problems You Can Fix with CMD
SD cards can develop errors that prevent normal use. Many of these issues, such as read-only status or file system errors, can be fixed directly using CMD. Below are some cases:
- Read-only or write-protected SD cards: CMD can remove software-based write protection, allowing you to add, delete, or modify files with the Diskpart prompt.
- File system errors: If the card has corrupted entries, incorrect file sizes, or other logical errors, CMD commands like chkdsk can check and repair the file system.
- Formatting problems: Sometimes, SD cards fail to format via Windows Explorer due to hidden errors. CMD can force a low-level format and recreate the file system.
- Drive letter issues: If your SD card isn’t recognized properly, CMD or Disk Management can assign a new drive letter to make it accessible again.
Conclusion
That’s all about how to format SD card using CMD. In case CMD runs into an issue while formatting the SD card, follow the solutions we’ve mentioned above to fix it. Just remember that formatting can also cause data loss. However, you can retrieve it using 4DDiG Data Recovery software. It is an easy-to-use tool that will reconstruct and find hidden, lost, deleted, and corrupted files.
Secure Download
Secure Download
ChatGPT
Perplexity
Grok