How to Format a Write-Protected Pen Drive in Windows 11 and 10 (2026)
Pen drive says “The disk is write-protected”? Remove the protection with DiskPart, format the drive, and learn the signs that the drive is failing.
When Windows says “The disk is write-protected”, the pen drive has been marked read-only, and you cannot copy, delete or format anything on it. To format a write-protected pen drive, first check for a physical lock switch, then clear the read-only attribute with the Windows DiskPart tool using attributes disk clear readonly, and then format the drive.
Here is the part most guides skip: if the read-only flag comes straight back after you clear it, the drive is usually not locked but dying. Many flash drives switch themselves to read-only when their memory wears out, precisely so you can still copy your files off. No software fixes that. So work through the steps below in order, and treat a stubborn drive as a warning to rescue your data, not as a puzzle to keep fighting.
Updated: 19 November 2026 — fully rewritten with the current DiskPart commands for Windows 10 and Windows 11.
Also read: How to Send Disappearing Messages on Instagram?
Quick summary
| Step | What to do | Fixes it when |
|---|---|---|
| 1 | Check the lock switch, try another port and another PC | The lock is physical or the port is faulty |
| 2 | Clear the read-only attribute in DiskPart | Windows has flagged the disk read-only |
| 3 | Clean and format the drive | The file system is damaged |
| 4 | Ask your IT team | An office policy blocks writing to USB drives |
| 5 | Copy your files off and replace the drive | The flag returns every time: the drive is failing |
Before you start
- Copy off anything you need. A write-protected drive can normally still be read. Formatting erases everything, so rescue your files first.
- Unplug other USB drives and external disks. DiskPart acts on whichever disk you select, and it does not ask twice.
- Use an administrator account. Microsoft states that you must be in the local Administrators group to run DiskPart.
Step 1: Rule out the simple causes
- Look along the edges of the drive for a small sliding lock switch. SD cards and their adapters have one, and so do a few pen drives. Slide it to the unlocked position.
- Plug the drive into a different USB port, directly on the computer and not through a hub.
- Try it on a second computer. If it is writable there, the problem is the first PC, not the drive.
Step 2: Remove write protection with DiskPart
DiskPart is the disk tool built into Windows 10 and Windows 11. Its attributes disk command displays, sets or clears the read-only attribute of a disk.
- Right-click the Start button and open Terminal (Admin) or Command Prompt (Admin).
- Type
diskpartand press Enter. - Type
list diskand press Enter. Find your pen drive by its size. - Type
select disk 1, replacing 1 with your pen drive’s number. Runlist diskagain: an asterisk (*) marks the selected disk. - Type
attributes diskto see whether “Read-only” is set to Yes. - Type
attributes disk clear readonlyand press Enter. - Type
exit.
diskpart
list disk
select disk 1
attributes disk
attributes disk clear readonly
exit
The size column is your safety check. A 32GB pen drive shows as roughly 28 to 30 GB, while your internal drive will be far larger. If two disks look alike, stop, unplug the pen drive, run list disk again and see which entry disappears.
Step 3: Format the pen drive
If the drive now accepts files, you can format it the normal way: open File Explorer, right-click the drive, choose Format and click Start. If File Explorer still refuses, format it from DiskPart instead.
diskpart
list disk
select disk 1
clean
create partition primary
format fs=exfat quick
assign
exit
cleanremoves all partition and volume formatting from the selected disk. Everything on it is gone, so confirm the disk number first.create partition primarycreates a new partition, and DiskPart moves the focus to it automatically.format fs=exfat quickformats it. exFAT works on Windows, macOS and most TVs and handles large files. Usefs=ntfsfor a Windows-only drive orfs=fat32for older devices that need it.assigngives the drive a letter so it appears in File Explorer.
Step 4: If it is an office computer
Many companies block writing to USB drives to stop data leaving the building. In that case every pen drive will look write-protected on that PC and work normally at home. This is a policy, not a fault, and the right move is to ask your IT team instead of trying to switch it off. If your business needs this kind of control, Suprams provides cybersecurity and data loss prevention services.
Step 5: When the drive cannot be saved
- The read-only attribute returns as soon as you unplug and reconnect the drive.
- DiskPart reports an error on
cleanorformat. - The drive shows the wrong size, or no size at all.
- It fails the same way on every computer.
Any of these points to a failing drive. Copy your files to another disk straight away, check whether the drive is still under the maker’s warranty, and replace it. Do not keep important files on a drive that has started doing this.
Mistakes people make most often
- Selecting the wrong disk. One wrong digit and
cleanwipes your backup drive. - Formatting before rescuing the files. The drive is readable now. It may not be later.
- Downloading “write protection remover” tools. They do nothing DiskPart cannot do, and many carry adware or worse.
- Forcing a failing drive back into service. It will fail again, and next time it may not let you read it.
Related guides: how to create a bootable USB drive, how to see a drive’s file system in Windows, and HDD vs SSD if you are choosing a replacement for long-term storage.
Frequently asked questions
Why is my pen drive suddenly write-protected?
The usual causes are a lock switch, a read-only attribute set in Windows, a damaged file system, an office policy or a failing drive that has locked itself to protect your data.
Which command removes write protection from a pen drive?
In DiskPart, select the drive and run attributes disk clear readonly. Run attributes disk first to confirm the read-only attribute is set.
Will removing write protection delete my files?
No. Clearing the read-only attribute does not erase anything. The clean and format commands do erase the drive.
Can a write-protected pen drive always be repaired?
No. If the protection returns after every attempt, the drive’s memory is usually worn out and the drive should be replaced.
The bottom line
Check the lock switch, clear the read-only attribute with DiskPart, then format. That fixes most write-protected pen drives in a few minutes. If the lock keeps coming back, stop trying to repair it: copy your files off while you still can and buy a new drive.
