SOLVED: Error while deleting key on Windows 10

Matthew Adams
by Matthew Adams
Windows & Software Expert
Affiliate Disclosure
Share this article:

  • Many users have tried using the Registry Editor to delete certain keys, only to be met by an error message.
  • The error message is the following: Cannot delete key: Error while deleting key.
  • In order to fix it, try editing your Registry Key permissions, or using a  third-party registry manager.
  • Follow this guide if you find yourself unable to delete registry keys.
To fix various PC problems, we recommend Restoro PC Repair Tool: This software will repair common computer errors, protect you from file loss, malware, hardware failure and optimize your PC for maximum performance. Fix PC issues and remove viruses now in 3 easy steps:
  1. Download Restoro PC Repair Tool that comes with Patented Technologies (patent available here).
  2. Click Start Scan to find Windows issues that could be causing PC problems.
  3. Click Repair All to fix issues affecting your computer's security and performance
  • Restoro has been downloaded by 0 readers this month.

Deleting registry keys isn’t something you should usually do. However, sometimes deleting a registry key might fix a system error.

Yet, this error message might occasionally pop up when you select to delete a locked registry key:

Cannot delete key: Error while deleting key.

This is how you can fix the error while deleting key error in Windows 10 that makes you unable to delete registry key.


How do I fix the Error while deleting key issue?

  1. Open the Registry Editor as Administrator
  2. Edit the Registry Key’s Permissions
  3. Add RegDelNull to Windows
  4. Delete the Key With Registry DeleteEx
  5. Registrar Registry Manager to Windows

1. Open the Registry Editor as Administrator

First, note that you might need to open the Registry Editor with admin rights, otherwise you cannot delete registry keys.

To do that, press the Cortana button on the taskbar. Then enter the keyword regedit in the search box, right-click regedit and select Run as administrator.


Can’t access Registry Editor? Check out this guide and solve the issue quickly.


2. Edit the Registry Key’s Permissions

Editing a registry key’s permissions will usually fix the Cannot delete key issue.

To do that, first open the Registry Editor as administrator as outlined above.

  • Right-click the registry key you need to delete and select Permissions to open the window shown directly below.
  • Press the Advanced button to open the window in the shot directly below.
  • Click the Change link at the top of the window.
  • Enter your own username in the Enter object name text box shown directly below.
  • Press the Check Names button on the Select User or Group window.
  • Press the OK button on the Select User or Group window.
  • Select your username on the Permissions for… window.
  • Select the Full Control’s Allow check box.
  • Then press the Apply and OK buttons to close the window.

Made a mistake in the Registry Editor? Don’t panic! Here’s how to undo registry changes!


3. Add RegDelNull to Windows

RegDelNull is a command-line utility program with which you can delete registry keys that otherwise return the “Cannot delete key” error message.

You can save the program’s ZIP file to Windows by clicking Download RegDelNull on this website page.

Open the program’s ZIP archive in File Explorer, press the Extract all button and select a folder path to extract it to.

Click the program’s exe in the extracted folder, and open the Command Prompt. Then you can delete registry keys by entering this command: regdelnull <key path> -s.


4. Delete the key with Registry DeleteEx

DeleteEx is an alternative program with a GUI that you can erase locked registry entries with.

Press the Download Now button on this website page to add DeleteEx to Windows. When you have the software open, you can enter the path of the registry entry to delete in a text box on the Delete Key tab.

Furthermore, you can also select to erase all the key’s subkeys. As this software includes more settings, DeleteEx might be a better program to delete registry entries with than RegDelNull.


Windows Registry Editor is a nightmare? Choose another registry editing tool!


5. Add Registrar Registry Manager to Windows

The Registrar Registry Manager is an alternative third-party registry editor for Windows. With that you can delete registry keys that you would otherwise need to adjust permissions for as outlined above.

The software also includes additional search, CLSID lookup and registry compare tools. You can add that software to Windows 10 by clicking Advanced Registry Manager on this webpage.

Then you can delete the required registry key in Registrar much the same as in the Registry Editor.


So you can fix the Cannot delete key error in Windows by adjusting the key’s permissions or by utilizing the Registrar, DeleteEx or RegDelNull software.

However, remember to back up the registry before erasing the locked registry keys. Alternatively, you can set up a restore point to roll Windows back to as covered in this post.

idee restoro Still having issues? Fix them with this tool:
  1. Download this PC Repair Tool rated Great on TrustPilot.com (download starts on this page).
  2. Click Start Scan to find Windows issues that could be causing PC problems.
  3. Click Repair All to fix issues with Patented Technologies (Exclusive Discount for our readers).
Restoro has been downloaded by 0 readers this month.
Editor's Note: This article was originally published in March 2018 and was revamped and updated in January 2021 for freshness, accuracy, and comprehensiveness.
Was this page helpful?
Thanks for letting us know! You can also help us by leaving a review on MyWOT or Trustpillot.
Get the most from your tech with our daily tips
Tell us why!