Home / Storage fixes / SD card write protection

How to Remove Write Protection from SD Card (and Fix "Can't Format SD Card")

"The disk is write protected," "read-only," "memory card locked." The same error shows up on Windows, Mac, Android, cameras and consoles. Find your device, follow the fixes in order, and save your files before you format anything.

Updated October 16, 2026. Works for SD, SDHC, SDXC and microSD cards, USB drives and memory sticks.

The tiny switch on the left is the first thing to check.

SD card with lock switch next to a laptop showing The disk is write protected error

Quick answer

Do this first: slide the lock switch on the SD card (or its adapter) toward the contacts, which is the unlocked position. If the card is still protected on Windows, open Command Prompt as administrator and run diskpart, list disk, select disk X, then attributes disk clear readonly. Still stuck? Work through the registry, BitLocker, policy and error-check fixes below.

Save your files first. A write-protected card can almost always still be read. Copy everything to your computer before formatting, because formatting erases the card.

Find my fixAnswer 2 quick questionsNo switch or broken switchFix 1 and Fix 3Diskpart and CMDFix 3MacDisk Utility and TerminalAndroid and phonesPixel, Samsung, GalaxyCameras and consolesCanon, GoPro, 3DS, GarminCan't formatFix 9Card is failingReplace and recover

What write protection means (and the error you see)

Write protection makes a card read-only. You can open and copy files, but you cannot save, delete, rename or format. It can be enforced by a physical switch, by the disk's read-only attribute, by Windows policy, by encryption, or by the card's own controller.

DeviceMessage
Windows"The disk is write protected," "Windows was unable to complete the format," "Remove write protection or use another disk"
Mac"The disk can't be modified," "read-only," "operation can't be completed"
Camera"Card locked," "Memory card is write protected," "Card error"
Android"SD card is read-only," "Can't write to SD card," "Blank SD card"
Nintendo 3DS"SD card is write protected" or save errors
Linux"Read-only file system," "Operation not permitted"

Find your fix in 2 questions

1. Where are you using the card?
2. What describes it best?
Choose one answer in each row.

Why an SD card becomes write protected

CauseClueFix
Lock switch on card or adapterFull-size card, or microSD in an adapterFix 1
Faulty reader, port or adapterCard works in another readerFix 2
Read-only disk attributeDiskpart shows Current Read-only State: YesFix 3
WriteProtect registry valueEvery USB drive is read-onlyFix 4
Group Policy deny-write ruleWork, school or shared PCFix 5
BitLocker To Go encryptionPadlock icon on the driveFix 6
File system errorsSlow card, missing files, RAW driveFix 7
Virus or malwareHidden files, shortcuts instead of foldersFix 8
Worn-out or fake cardRead-only again after every fixDead card section

Fix 1: Unlock the physical lock switch

Easy1 minuteFixes: locked full-size SD, adapter locks
  1. Remove the card and look at the left edge (card label facing up, contacts down). Find the small slider.
  2. Slide it up toward the contacts into the unlocked position. Down toward the label end locks it.
  3. Reinsert it and try saving a file.

MicroSD cards have no switch, but the SD adapter does. A switch that is loose, broken or stuck halfway can fool the reader, so slide it firmly several times. If it still reports locked, try another adapter. Some people tape over the switch notch on a broken adapter, but a replacement adapter is cheap and more reliable.

Fix 2: Rule out the reader, port and cable

Easy5 minutesFixes: reader reports lock that is not there

If the card works as writable elsewhere, the original reader or its driver is the problem. If it is read-only everywhere, continue.

Fix 3: Clear the read-only attribute with Diskpart (CMD)

Medium5 minutesFixes: no switch, "disk is write protected" in Windows 10 and 11
  1. Press Win+X and choose Terminal (Admin) or Command Prompt (Admin).
  2. Run the commands below. Replace 2 with the number of your SD card, matching its size.
diskpart
list disk
select disk 2
attributes disk
attributes disk clear readonly
attributes volume clear readonly
exit

Success looks like "Disk attributes cleared successfully." The first attributes disk line shows Current Read-only State so you can confirm before and after.

Pick the right disk. Selecting your C: drive by mistake is the biggest risk. Confirm the size in list disk. Do not use clean unless you intend to erase the card.

Diskpart cannot remove a hardware, firmware or policy lock. If the attribute returns after you reinsert the card, go on to the other fixes.

Fix 4: Check the WriteProtect registry value

Medium5 minutesFixes: all USB and SD storage read-only on one PC
  1. Press Win+R, type regedit, press Enter.
  2. Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies.
  3. Set WriteProtect to 0. If the key does not exist, the registry is not the cause.
  4. Restart and reinsert the card.

Or run this in an admin Command Prompt after backing up the registry:

reg add "HKLM\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies" /v WriteProtect /t REG_DWORD /d 0 /f

Fix 5: Remove a Group Policy or removable storage block

Medium5 minutesFixes: work, school and shared computers

On Windows Pro, Enterprise and Education, press Win+R, run gpedit.msc and go to Computer Configuration → Administrative Templates → System → Removable Storage Access. Set Removable Disks: Deny write access to Not Configured or Disabled.

On Windows Home, check HKLM\Software\Policies\Microsoft\Windows\RemovableStorageDevices for a Deny_Write value of 1. On a managed PC, only your administrator can lift the rule, and it can return at the next policy refresh.

Fix 6: Unlock a BitLocker-encrypted card

Easy3 minutesFixes: padlock icon, locked drive, read-only access

A card encrypted with BitLocker To Go shows a padlock. Open it in File Explorer, enter the password or recovery key, or check status:

manage-bde -status E:
manage-bde -unlock E: -Password

Without the password or recovery key, the data cannot be read. Find the key in your Microsoft account or printed backup.

Fix 7: Scan and repair file system errors

Easy10 to 60 minutesFixes: corrupted card, RAW drive, slow card
  1. Open This PC, right-click the card → Properties → Tools → Check.
  2. Or use an admin Command Prompt (replace E: with your drive):
chkdsk E: /f /r

The /r option scans for bad sectors and can take a long time on large cards. Many bad sectors suggest the card is wearing out.

Fix 8: Scan for malware and unhide files

Easy10 minutesFixes: shortcut viruses, hidden or read-only files
  1. Run Windows Security → Virus & threat protection → Scan options → Full scan with the card inserted.
  2. If folders became shortcuts, restore them (replace E:):
attrib -h -r -s /s /d E:\*.*

Fix 9: Format the card after protection is removed

Medium5 minutesFixes: "Windows was unable to complete the format"

Copy your files off first. Then use one of these:

diskpart
list disk
select disk 2
clean
create partition primary
format fs=exfat quick
assign
exit
Card sizeFile systemNote
Up to 32 GBFAT32Best for cameras, 3DS and older devices
64 GB and largerexFATSupports files above 4 GB. Check your device supports it.

Remove write protection on Mac

  1. Check the lock switch on the card or adapter.
  2. Open Disk Utility, select the card and click First Aid.
  3. Select the file or folder, press Cmd+I and check Sharing & Permissions. Set your user to Read & Write, and unlock the padlock if needed.
  4. Copy your files, then erase the card in Disk Utility with ExFAT or MS-DOS (FAT) and Master Boot Record.

Terminal option (replace disk4 with your card, and be careful because this erases it):

diskutil list
diskutil unmountDisk /dev/disk4
diskutil eraseDisk ExFAT SDCARD MBR /dev/disk4

NTFS cards are read-only on macOS by default, which looks like write protection. Reformat as ExFAT to write to it.

Remove write protection on Android and phones

Cameras, consoles and other devices

DeviceWhat to do
Canon, Nikon, Sony camerasCheck the card's lock switch, then format in the camera menu. If it fails, use Fix 3 and the SD Memory Card Formatter.
GoProUnlock the adapter, then Preferences → Reset → Format SD Card. Use a name-brand card in exFAT.
Garmin and HumminbirdUse the card's lock switch, and format FAT32 on a PC. Use cards at or below the maximum size the unit supports.
Nintendo 3DS / 2DSCheck the card's switch (3DS slides it up to unlock). Format as FAT32 on a PC, then back up first.
Raspberry PiRaspberry Pi OS may boot read-only after a power cut. Check the adapter switch, run sudo fsck on a Linux PC, and reflash if needed.
Dashcams, drones, Kindle FireFormat in the device. If it reports a locked card, clear the attribute on a PC.
Xbox, Meta QuestThese do not use standard SD cards. A read-only error here comes from the PC reader or another device.

Linux

lsblk
dmesg | tail -20
sudo blockdev --setrw /dev/sdb
sudo umount /dev/sdb1
sudo fsck -f /dev/sdb1

Replace sdb with your card. If dmesg shows the device as write-protected, the lock is a switch or hardware, not software.

How to remove write protection without losing data

  1. Copy all files to a computer. Read access works even when the card is locked.
  2. Use the fixes that do not erase data first: Fix 1 to Fix 8. They clear flags and do not touch files.
  3. Only format after your files are safe.
  4. If files are missing, stop writing to the card and use recovery software on a different drive.

When the SD card is failing (and what to do)

Memory cards wear out. Some controllers lock a failing card read-only on purpose, to protect the remaining data. That cannot be undone with software.

SignMeaning
Read-only again after every fixController lock from wear
Wrong or tiny capacity (for example 0 bytes)Failing or counterfeit card
Many bad sectors in chkdskWorn flash
Fails in every reader and deviceCard is dead

Copy off what you can, then replace the card. Cards from SanDisk, Samsung and Lexar usually carry a limited warranty, so keep your receipt. Test new cards with H2testw (Windows) or F3 (Mac, Linux) to detect fake capacity.

Common mistakes to avoid

How to prevent write protection problems

Checklist: lock switch, other reader, Diskpart, registry, policy, BitLocker, chkdsk, malware scan, then format. If it is still read-only, replace the card.

Frequently asked questions

How do I remove write protection from an SD card?

Slide the lock switch on the side of the SD card or adapter to the unlocked position. If the card has no switch or is still protected, open Command Prompt as administrator, run diskpart, list disk, select disk X, then attributes disk clear readonly. If that fails, check the registry, BitLocker, Group Policy and card errors.

How do I remove write protection from an SD card without a switch?

Most microSD cards have no switch. Check the adapter's switch, then use Diskpart to clear the read-only attribute, check the WriteProtect registry value, scan for errors with chkdsk and try a different card reader. If nothing works, the card has likely failed.

Why does my SD card say the disk is write protected?

The cause is a locked switch, a read-only disk attribute, a registry or Group Policy restriction, BitLocker encryption, file system errors, a virus, or a worn-out card whose controller locked it to read-only.

Can I format a write-protected SD card?

Not until the protection is removed. Unlock the switch, clear the read-only attribute with Diskpart, then format in Disk Management or with the SD Memory Card Formatter. Formatting erases all data, so copy files off first.

Is Diskpart safe to use on an SD card?

Yes, if you select the correct disk. Check the disk size in list disk, never select your system drive, and use attributes disk clear readonly, which does not erase data. The clean command does erase everything.

How do I remove write protection from an SD card on Mac?

Check the lock switch first, then run First Aid in Disk Utility. If the card is still read-only, check permissions with Get Info or erase the card in Disk Utility using ExFAT or MS-DOS (FAT) after copying your files.

How do I remove write protection from an SD card on Android?

Phones rarely have a lock setting. Check the adapter if one is used, then format the card as portable storage in Settings. If that fails, insert the card in a PC with a card reader and use Diskpart or Disk Management.

Why can't I remove write protection even after Diskpart?

Diskpart cannot override hardware or firmware locks, Group Policy, or BitLocker. A card that reverts to read-only after clearing the attribute usually has a failing controller and should be replaced.

How can I save my files from a write-protected SD card?

A write-protected card can still be read. Copy everything to your computer first, using a different reader if one fails, then fix or replace the card. Stop writing to a failing card and use recovery software if files are missing.

What format should I use for an SD card?

Use FAT32 for cards up to 32 GB and exFAT for larger cards. Windows may not offer FAT32 for cards over 32 GB, so use the SD Memory Card Formatter from the SD Association.

Does a write-protected SD card mean it is broken?

Not usually. A locked switch or read-only attribute is common and fixable. A card that goes read-only again and again, shows the wrong capacity or has bad sectors is failing.