Why your USB drive is write-protected and how to fix it

A USB drive shows write protection when your computer refuses to let you delete, edit, or add files to it. The drive itself is telling your system "do not write to me" — either because a physical switch on the drive is in the locked position, because Windows or Mac has detected a problem, or because the drive's firmware has been set to read-only mode. You can remove this protection, but the method depends on which of these three things is actually happening.

Start by checking whether your USB drive has a physical lock switch. Many drives, especially older ones or those made for security, have a small sliding switch on the side or end. Slide it toward the unlocked position — usually marked with an open padlock icon. If your drive has this switch and it is in the locked position, that is your answer. Slide it to unlock and try using the drive again.

If there is no physical switch, or if unlocking it did not work, the protection is set in software. The steps to remove it differ between Windows and Mac.

Key Takeaways

  • Check for a physical lock switch on the USB drive itself first — if it exists and is in the locked position, simply slide it to unlock.
  • On Windows, use Diskpart (a built-in command tool) to remove write protection by marking the drive as not read-only.
  • On Mac, use Terminal to change the drive's permissions, or try reformatting the drive as a last resort.
  • If the drive is damaged or the firmware is corrupted, reformatting will erase all data but may restore the drive to working condition.

Remove write protection on Windows using Diskpart

Diskpart is a Windows command tool that can change how your system sees the drive. Open it by pressing the Windows key, typing cmd, right-clicking on Command Prompt, and selecting Run as administrator. Click Yes when Windows asks for permission.

Type this command exactly and press Enter: diskpart. The prompt will change to show DISKPART>. Now type list disk and press Enter. You will see a list of all drives connected to your computer. Find your USB drive in the list — it is usually the smallest one by size. Note its number (Disk 1, Disk 2, and so on).

Type select disk X (replace X with your drive's number) and press Enter. Then type attributes disk clear readonly and press Enter. This command tells Windows to stop treating the drive as read-only. Close the Command Prompt window and try using your USB drive again. You should now be able to delete and add files.

If you selected the wrong disk, you could damage your computer's main drive. Double-check the size in the list before you run the select disk command. If you are unsure, unplug all other USB devices first so only your target drive is connected.

Remove write protection on Mac using Terminal

On Mac, open Terminal by pressing Command + Space, typing terminal, and pressing Enter. Plug in your USB drive if you have not already. Type diskutil list and press Enter to see all connected drives. Find your USB drive in the list — it will show a name like /dev/disk2 or similar, and the size should match your drive.

Type diskutil info /dev/diskX (replace X with your drive's number) and press Enter. Look for a line that says Read-Only Media. If it says Yes, your drive is write-protected. Type diskutil secureErase freespace 0 /dev/diskX and press Enter. This will erase the drive and remove the protection. You will be asked to confirm — type your Mac password and press Enter.

If the drive still shows as read-only after this, the protection may be at the firmware level and cannot be removed through the operating system. In that case, reformatting (see below) is your next option.

Reformat the drive to remove stubborn write protection

Reformatting erases everything on the drive and rebuilds its file system from scratch. This often removes write protection that is stuck in the drive's firmware. On Windows, right-click the USB drive in File Explorer, select Format, choose a file system (FAT32 works on both Windows and Mac), and click Start. Confirm that you want to erase the drive.

On Mac, open Disk Utility (in Applications > Utilities), select your USB drive from the list on the left, click Erase, choose a format (Mac OS Extended or ExFAT), and click Erase again. The drive will be wiped and reformatted.

After reformatting, test whether you can now write to the drive. Create a new folder or copy a file onto it. If this works, the write protection has been removed. If the drive still refuses to accept new files, the drive itself may be failing and may need to be replaced.

What to do if nothing works

If you have tried the physical switch, Diskpart or Terminal, and reformatting, and the drive still will not accept new files, the protection is likely built into the drive's hardware or firmware in a way that cannot be changed from your computer. Some enterprise or security-focused USB drives are designed this way intentionally.

Check the drive's manufacturer website to see whether they offer a utility tool to unlock it. Search for the drive model plus "write protection removal tool" or "unlock utility". Some manufacturers like Kingston, SanDisk, and Transcend provide these tools for their drives. Download and run the tool according to the manufacturer's instructions.

If no tool exists or it does not work, the drive may be damaged or the protection may be permanent. At that point, the drive is not usable for storing new files and should be replaced.

Prevent write protection from happening again

Write protection usually happens because the drive's file system became corrupted, the drive was ejected unsafely while files were being written, or the drive is very old and the storage cells are failing. To reduce the risk, always eject the drive properly before unplugging it. On Windows, right-click the drive in File Explorer and select Eject. On Mac, drag the drive icon to the Trash or right-click it and select Eject.

Avoid filling the drive completely full — leave at least 10 percent of space empty. Do not unplug the drive while files are being copied to it. If you see a progress bar, wait for it to finish before removing the drive. These habits will help keep your USB drive in working condition and reduce the chance of write protection errors.

Frequently Asked Questions

Will reformatting the drive erase all my files?

Yes. Reformatting rebuilds the drive's file system from scratch, which erases everything on it. If you have files you need, try to copy them to your computer first. If the drive is write-protected, you may not be able to copy files off it, so you may have to choose between keeping the files or removing the protection.

Is it safe to use Diskpart if I am not sure which disk number is my USB drive?

No. If you select the wrong disk, you could damage your computer's main drive or other storage. Unplug all other USB devices before you start, so only your target drive is connected. Double-check the size in the list before you run any commands.

Why does my USB drive keep getting write-protected even after I remove it?

The drive may be failing. Storage devices that are very old or have been used heavily sometimes develop errors that cause the drive to lock itself as a safety measure. If this happens repeatedly, the drive is likely nearing the end of its life and should be replaced.

Can I remove write protection from a drive that belongs to someone else?

Technically yes, but you should not. If the drive is intentionally write-protected by its owner, removing that protection without permission is not appropriate. If you need to use a protected drive, ask the owner for help or for an unprotected copy of the files.