How To Use The Cipher Command In Windows (2026)
Cipher shows and changes the encryption of folders and files on NTFS drives, and it can also wipe the free space on a volume.
The two most used forms are cipher /e foldername to encrypt and cipher /w:C to overwrite deleted data.
This guide follows Microsoft’s cipher reference and its Cipher.exe troubleshooting article, so each switch below is documented.
Table of Contents
- Cipher quick answers
- What the cipher command does
- Open Command Prompt
- The cipher syntax
- Check what is encrypted
- Encrypt a folder or file
- Decrypt a folder or file
- Switches for the encrypt and decrypt forms
- Overwrite deleted data with cipher /w
- What cipher /w does and does not touch
- Back up your EFS certificate and key
- Recovery agents and key updates
- Why cipher /w also covers encryption leftovers
- Add and remove users on encrypted files
- Related guides
- Official sources
- More Windows guides
Cipher quick answers
| I want to | Type this |
|---|---|
| See which files are encrypted | cipher |
| Encrypt a folder | cipher /e private |
| Decrypt a folder | cipher /d private |
| Show information about encrypted files | cipher /c |
| Overwrite deleted data on drive C | cipher /w:C |
| Back up my EFS certificate and keys | cipher /x backupfile |
What the cipher command does
Cipher displays or alters the encryption of directories and files on NTFS volumes.
Run without parameters, it shows the encryption state of the current directory and the files in it.
It works with the Encrypting File System, so it only applies to NTFS drives.
Open Command Prompt
- Press the Windows key and type **cmd**.
- Select **Command Prompt**.
- Type your cipher command and press **Enter**.
For a full-volume wipe or for protected folders, open Terminal as administrator first.
The cipher syntax
Microsoft lists several forms, one for each job.
| Form | Used for |
|---|---|
cipher [/e | /d | /c] [/s: | Encrypting, decrypting and viewing files |
cipher /k | Creating a new EFS certificate and key |
cipher /r: | Creating a recovery agent key and certificate |
cipher /u [/n] | Finding encrypted files and updating keys |
cipher /w: | Clearing data from unused disk space |
cipher /x[:efsfile] [filename] | Backing up the EFS certificate and keys |
cipher /y | Showing the thumbnail of your current EFS certificate |
cipher /adduser, /removeuser, /rekey | Managing which users and keys can open encrypted files |
Check what is encrypted
Typing cipher alone lists the current folder, and Microsoft’s sample output marks each item with a letter.
An **E** in front of a name means it is encrypted, and a **U** means it is not.
The listing also tells you that new files added to a directory will not be encrypted unless the directory itself is marked.
Encrypt a folder or file
Use cipher /e followed by the folder or file name, as in Microsoft’s example cipher /e private.
The command reports each item with [OK] and a count of the files and directories that were encrypted.
Microsoft says marked directories also encrypt files that are added to them later.
Run cipher again afterward and the folder should now show an E.
Decrypt a folder or file
Use cipher /d followed by the name to decrypt the specified files or directories.
Microsoft also warns that if the parent directory is not encrypted, an encrypted file can become decrypted when it is modified.
The fix is to encrypt the parent directory together with the file.
Switches for the encrypt and decrypt forms
| Switch | What it does |
|---|---|
/e | Encrypts the specified files or directories. |
/d | Decrypts the specified files or directories. |
/c | Displays information about encrypted files. |
/s: | Applies the operation to all subdirectories of that directory. |
/b | Stops if an error occurs, because by default cipher continues past errors. |
/h | Includes files with hidden or system attributes, which are skipped by default. |
Multiple directory names and wildcards are allowed, and you separate multiple parameters with spaces.
Overwrite deleted data with cipher /w
When you delete a file, its data stays on the disk because only the space is marked as available.
Until something overwrites it, low-level disk tools or recovery software can bring that data back.
The command cipher /w: clears data from the unused space on the whole volume that contains the directory you name.
Microsoft’s example for drive C is cipher /w:C.
What cipher /w does and does not touch
- It overwrites only deallocated space, so existing files and folders are not touched.
- The directory can be any folder on the volume, but the scope is the entire volume.
- If the directory is a mount point or sits on another volume, all free space on that volume is cleaned.
- Microsoft says the removal is permanent.
- Large amounts of free space can take a long time to overwrite.
Microsoft recommends quitting all programs before you run it.
Other parameters are ignored when you use /w.
Back up your EFS certificate and key
The /x switch backs up your EFS certificate and keys to a file.
Add :efsfile to back up the certificates used to encrypt one particular file.
The /y switch shows the thumbnail of your current EFS certificate on the local computer.
The /k switch creates a new EFS certificate and key, and other parameters are ignored when you use it.
Recovery agents and key updates
The /r switch generates an EFS recovery agent key and certificate as a .pfx file plus a .cer file.
With /smartcard, it writes to a smart card instead and creates no .pfx file.
An administrator can add the .cer contents to the EFS recovery policy, then import the .pfx file to recover individual files.
The /rekey switch updates the specified files to use the currently configured EFS key.
Why cipher /w also covers encryption leftovers
Microsoft explains that when EFS encrypts a plain-text file, it first creates a temporary backup copy of that file.
That backup is deleted afterward, but like any deleted file its data stays on the disk until something overwrites it.
The free-space wipe is the documented way to clear those remnants, and Microsoft says the Cipher utility on currently supported Windows versions is designed to prevent unauthorized recovery of such data.
Add and remove users on encrypted files
| Switch | What it does |
|---|---|
/adduser | Adds a user to the specified encrypted files, using /certhash: or /certfile:. |
/removeuser | Removes a user from the specified files, and you must give the SHA1 hash of the certificate to remove with /certhash:. |
/u | Finds all encrypted files on local drives and updates user or recovery agent keys that have changed. |
/u /n | Finds encrypted files but makes no updates. |
Both /adduser and /removeuser also accept /s, /b and /h along with one or more path names.
Related guides
If you need to turn off drive-level protection instead, see how to turn off BitLocker device encryption.
To encrypt a removable drive, use BitLocker To Go on a USB drive.
To erase a whole disk rather than free space, read the DiskPart clean guide.
Official sources
The switches come from Microsoft’s cipher reference.
The free-space details come from Microsoft’s article on using Cipher.exe to overwrite deleted data.
More Windows guides
- How To Uninstall ESET From Windows Step By Step (2026)
- How To Uninstall Kaspersky Completely From Windows (2026)
- Local Security Authority Protection Is Off In Windows 11 (2026)
- How To Use Ping And Tracert In Windows 11 (2026)
- How To Change UAC Settings In Windows 11 (2026)
- How To Rip A CD To Your PC In Windows 11 (2026)
See all: Windows 11 Guides