If you try to delete a Registry key in Windows 11/10 or Windows Server and encounter an error message: “Error while deleting key,” this article may help you. It can be caused by various reasons. You might not be able to delete a locked Registry key because Access is denied or any other application or even malware has locked it down.
![]()
Error deleting key, Cannot delete Registry key in Windows 11/10

Error Deleting Key, Cannot delete Registry key, Error while deleting key.
This can also be caused if the key is protected by system permissions (TrustedInstaller, SYSTEM or Administrator restrictions) or if the registry key contains embedded null characters. These characters are not visible when viewing the registry entry.
To delete a registry key that contains an embedded null character, you must first replace the null character with another character.
It is best to back up the Registry and create a Restore Point first.
1] Use Systernals RegDelNull tool
You can accomplish this by using the RegDelNull tool from Sysinternals.
This command-line utility searches for and allows you to delete Registry keys that contain embedded-null characters and that are otherwise undeletable using standard Registry-editing tools. You can use the following command:
regdelnull -s
This will scan and delete registry keys with embedded null characters.
You should note that deleting Registry keys may cause the associated applications to fail.
2] Take ownership and then try to delete

Using our free tool RegOwnIt, you can take ownership of the Registry key and then try to delete it.
Please be careful when you use this method.
3] Try in Safe Mode
Boot your computer in Safe Mode and then see if you can delete the registry key.
4] Use Registry DeleteEx

Registry DeleteEx can delete the keys that the Registry Editor and other tools fail to do so. The tool deletes locked keys and values using a kernel-mode driver. This means any Registry value can be deleted, even if an application or malware has locked it.
It is common for malware to lock Registry values and introduce malicious values inside the Registry. This tool not only helps you remove such values but also plays a key role in identifying the malware. Deleting Registry keys does involve some risk. We recommend deleting the correct key and taking a Registry backup before proceeding.
The tool itself is very simple to use. It does come with a few advanced options, but you can stick to basic features and get your work done. To start deleting a locked key or value, go to the appropriate tab. If you want to delete a key, then go to Delete Key tab else you can go to Delete Value tab.
Now you need to enter the path to your key. Have a look at the given example for reference. The program supports HKCR, HKCU, HKLM and HKCC aliases and you can easily use them in the path to your Registry key or value.
Now the last option that you have to configure is the recursive behavior of the tool. Registry DeleteEx can recursively delete all subkeys inside the entered path. This can be toggled using the checkbox just below the textbox. All set, now you can hit the Delete button to completely remove a locked Registry key from your computer. A similar set of steps can be followed for Registry values.
There is one more tab available that reads Expert Only. This tab includes some extra advanced options in case you need them. The Expert only tab lets you delete registry keys or values by entering their raw name.
Registry DeleteEx is an effective remedy for malware that can block your computer’s Registry and cause serious problems. The tool is free, simple to use and gets the job done quickly. The tool involves removing Registry keys and values, so we advise you to take a full backup of the registry in case anything goes wrong.
Visit appsvoid.com to download Registry DeleteEx. UPDATE: It was free earlier – but it now a paid tool. You need to take the utmost precaution while using this tool to delete undeletable registry keys as deleting the wrong one could make your system unstable
All the best.
Read: Error Opening Registry Key, An error is preventing this key from being opened
Why can I not delete registry key?
You may be unable to delete a registry key because it contains an embedded null character. It can also occur if the Registry key is system-protected or currently locked.
Related: Error deleting Values, Unable to delete all specified values in REGEDIT
How do I manually delete registry keys?
To manually delete registry keys, open Registry Editor and navigate to the desired key or registry value. Right-click on it, and select Delete. Do note that you will not be able to delete top-level keys or registry hives.