Fixes / Windows · Checked

"The disk is write-protected" in Windows: how to fix it

Short answer

"The disk is write-protected" means Windows is blocking any write, delete or format on that drive because something has marked it read-only: a lock switch, a DiskPart read-only flag, a registry or Group Policy setting, or a worn-out flash chip. Most likely fix: slide the Lock switch on the SD card or USB stick up, then run DiskPart and type attributes disk clear readonly.

What this message means

Windows shows this message when you try to copy, save, delete, rename or format something on a drive that is currently mounted as read-only. You can still open and copy files off the drive, but nothing can be changed on it. The block can come from four places: a physical Lock switch on the card or stick, a read-only attribute stored on the disk itself, a setting on this PC (the WriteProtect registry value or a Group Policy that denies write access to removable drives), or the drive hardware, which puts itself into permanent read-only mode when its flash memory is wearing out. Which one applies decides whether the fix takes seconds or the drive needs replacing.

Common causes

CauseHow to tell
The physical Lock switch on the SD card, microSD adapter or USB stick is in the locked positionThere is a small slider on the side of the card, adapter or stick, usually marked "Lock". The error appears on every computer you plug it into, and it often starts right after inserting the card into a reader.
The disk or volume has the read-only attribute setIn DiskPart, after select disk, the attributes disk command shows "Current Read-only State: Yes" or "Read-only: Yes". This often follows using the drive with a camera, a TV, a disk-imaging tool or another OS.
The WriteProtect registry value on this PC is set to 1Every USB drive you plug into this particular PC is write-protected, but the same drives work normally on other computers. The value 1 exists under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies.
A Group Policy or BitLocker policy denies write access to removable drives (common on work and school PCs)The PC is managed by an employer or school, all removable drives are read-only, and Windows may offer to encrypt the drive with BitLocker before you can write to it. Drives encrypted with BitLocker work, unencrypted ones do not.
The flash memory or controller is failing and has locked itself into read-only modeThe drive is read-only on every computer, the Lock switch (if any) is off, attributes disk clear readonly reports success but the flag returns after you unplug and replug it, and formatting fails with "Windows was unable to complete the format".

How to fix it

1. Unlock the physical write-protect switch

  1. Safely eject the drive and remove it from the computer.
  2. Look for a small slider on the side of the SD card, the microSD-to-SD adapter or the USB stick.
  3. Slide it to the unlocked position (on SD cards, up toward the metal contacts, away from the word "Lock").
  4. If the slider is loose or feels like it moves on its own, the card reader may still read it as locked. Try a different adapter or card reader.
  5. Reinsert the drive and try copying a file again.

2. Clear the read-only attribute with DiskPart

Windows 10 and Windows 11

  1. Right-click Start and choose Terminal (Admin) on Windows 11 or Windows PowerShell (Admin) on Windows 10. Approve the User Account Control prompt.
  2. Type diskpart and press Enter, then type list disk and press Enter.
  3. Identify the USB drive or SD card by its size, then type select disk N (replace N with its number). Choosing the wrong disk affects that disk instead, so double-check the size.
  4. Type attributes disk to see the current state. If it shows "Current Read-only State: Yes", type attributes disk clear readonly and press Enter.
  5. Type list volume, then select volume N for the drive's volume, then attributes volume clear readonly.
  6. Type exit, unplug the drive, plug it back in and test. If the read-only flag comes back, the drive hardware is likely failing (see the last fix).

3. Set the WriteProtect registry value to 0

Windows 10 and Windows 11 (all editions)

  1. Press Windows key + R, type regedit and press Enter. Approve the User Account Control prompt.
  2. Go to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies. If the StorageDevicePolicies key does not exist, the registry is not the cause and you can skip this fix.
  3. Double-click WriteProtect in the right pane.
  4. Change Value data to 0 and click OK.
  5. Restart the PC, then reconnect the drive and test.

4. Turn off the Group Policy settings that deny write access

Windows 10 and 11 Pro, Enterprise and Education (Local Group Policy Editor is not included in Home)

  1. Press Windows key + R, type gpedit.msc and press Enter.
  2. Go to Computer Configuration > Administrative Templates > System > Removable Storage Access and set "Removable Disks: Deny write access" to Not Configured or Disabled. Check the same setting under User Configuration > Administrative Templates > System > Removable Storage Access.
  3. Go to Computer Configuration > Administrative Templates > Windows Components > BitLocker Drive Encryption > Removable Data Drives and set "Deny write access to removable drives not protected by BitLocker" to Not Configured or Disabled.
  4. Open Terminal (Admin), run gpupdate /force, then reconnect the drive.
  5. If the settings are greyed out or switch back, your organization enforces them through domain policy or Intune. Ask IT, or encrypt the drive with BitLocker if that is what the policy allows.

5. Copy your files off, then reformat the drive

  1. Open the drive in File Explorer and copy everything you need to your PC. Reading still works on a write-protected drive.
  2. In File Explorer, right-click the drive under This PC and choose Format.
  3. Pick exFAT as the File system (works on Windows, Mac, cameras and most TVs), leave Quick Format ticked and click Start.
  4. If Format fails with "Windows was unable to complete the format" or the drive is still write-protected afterwards, test it on another computer.
  5. If it is read-only on every computer after the fixes above, the flash memory has locked itself to protect your data. Replace the drive. Formatting tools cannot undo a hardware lock.

Next time, skip the search

Crade is an AI assistant for Mac and Windows that sees your screen. When a message like this pops up, ask “what does this mean?” and it explains the exact error in front of you, step by step.

Download Crade

Still not fixed?

Plug the drive into a different computer first. If it is writable there, the problem is a setting on your PC (registry, Group Policy or management by your organization's IT department, who can confirm whether USB write access is blocked on purpose). If it is read-only everywhere and DiskPart cannot clear the flag, the drive has failed into read-only mode. Copy your data off while it still reads, then contact the manufacturer (SanDisk, Kingston, Samsung and others offer warranty replacement, often 5 years or more for cards and sticks). For an internal disk that suddenly turns write-protected, back it up immediately and check its health with the manufacturer's diagnostic tool.

Questions people ask

Can I remove write protection without losing my data?

Yes. Moving the Lock switch, clearing the DiskPart read-only attribute, and changing the registry or Group Policy do not erase anything. Only formatting deletes data, so copy your files off first if you plan to format.

Why does my SD card say write-protected when the lock switch is already unlocked?

The card reader detects the switch mechanically, so a loose slider or a worn adapter can still read as locked. Try another adapter or reader. If it is read-only in every reader, the card has likely reached the end of its life and locked itself.

DiskPart says the attributes were cleared, but the drive is still write-protected. Why?

If the read-only state returns after you replug the drive, the drive's controller is enforcing it in hardware and Windows cannot override it. This usually means the flash memory is worn out and the drive needs replacing.

Why are all USB drives write-protected on my work laptop?

Your organization probably enforces "Removable Disks: Deny write access" or requires BitLocker encryption before removable drives can be written to. These are deliberate security settings, so ask IT rather than changing them yourself.

Will formatting remove write protection?

Formatting only works if the protection is not active, since Windows cannot format a write-protected drive. Clear the switch, attribute or policy first. If Format still fails, the protection is in the hardware.

Sources