There's nothing more mysterious on a Windows PC than the Registry, and today we'll explain exactly what it is, how it works, and whether you should bother cleaning it. We'll also go about debunking a few widespread registry myths along the way.

As I said, the registry has always been mysterious—if not entirely misunderstood—component of the Windows operating system. Today I've set out to explain in detail what the registry is all about. If you already have a working understanding of the registry, skip down to themythbusting sectionfor a little clarity regarding the usefulness of the many registry cleaners out there.

Application settings used to be stored in text-based configuration files (and with some applications, still are), with a separate file for every application. The Windows Registry is meant to solve that problem by providing a single place for all settings across all applications.

In addition to consolidating system settings, storing all of these settings in a single place and in a database format means that accessing values in the registry is much faster than parsing a text configuration file—so the registry can be used for more than just settings. In fact, most or all of the registry is read into memory each time the system boots, so accessing the registry is nearly instant.

Editing the Registry

There are a number of methods for editing the registry, but most of the time you'll just use the regedit.exe utility to make changes, which you can launch from the start menu search or run boxes. (Hit Win+R, pasteregedit.exe, then hit Enter and you're there.) Once you've opened up the editor, you'll be presented with a tree view of keys on the left-hand side, and the values on the right. The most important thing you'll want to do when editing the registry is to export the entire key before you make any changes—don't ever assume that you can just change the value back.

You can use regedit to connect to another PC and edit the registry there, provided you have the proper network access and the remote registry service is running. You can also edit from the command line using the reg.exe utility, which can be very helpful if you need to make a registry change from a machine that won't boot anymore—if you can make it to the recovery console, you can manually make the registry change from the command line.

What Are These .reg Files?

If you spend any amount of time browsing Windows-tweaking web sites, you've undoubtedly come across a downloadable .reg file that somebody provides as a way to quickly add a setting to the registry. These files are nothing more than simple text files that contain instructions for the regedit utility to add, change, or remove keys in the registry without any accidental typos that cause your system to crash.

My recommendation is that before you apply any of these files, you first open them up in a text editor to see what they really contain, but in general, applying a .reg file is a lot safer and easier than manually making registry edits, provided you trust the source.

How Is the Registry Stored, and How Do I Back it Up?

Even though the registry is supposed to be one consolidated place to store everything on your system, it's not stored in a single file—all of the system hives other than HKEY_CURRENT_USER are stored under %SystemRoot%\System32\Config, and the rest are stored in the %SystemRoot%\Profiles\Username folder, and there are a lot of files to deal with.

If you only need to backup a portion of the registry, you can open up regedit, find the key in the left-hand panel that you'd like to backup, and use the Export feature from the right-click menu to save the entire section to a text file format. You'll probably not want to use this to backup the entire registry, but it can be useful if you want to keep a copy of HKEY_CURRENT_USER around in case you need to restore some settings—and you're ready to do some seriously geeky registry hacking. For the average user, System Restore is not just the preferred option, but it's also theone that Microsoft recommends.

Do You Really Need to Clean the Registry?

The internets are chock full of advertisements and testimonials for registry cleaning products that claim to fix every problem on your PC by giving your registry a good scrubbing; readers may even remember an unofficial Microsoft-supplied utility called regclean from years back, which gives even more validity to the idea that registry cleaning is a very useful pursuit. But do they really work?

The sad answer, which we covered whiledebunking performance tweaking myths, is that most of these products are not worth running, and while the better ones won't necessarily kill your PC, they're rarely going to help you a lot either. If you stop and think about it, you'll realize that since the registry contains many hundreds of thousands of keys (or more), removing 50 or even 100 of them isn't going to yield any performance gains.
Windows expert Ed Bott hassome stronger words on the subject:

I'd go a step further: Don't run registry cleaner programs, period. I won't go so far as to call them snake oil, but what possible performance benefits can you get from "cleaning up" unneeded registry entries and eliminating a few stray DLL files?

That said, there are a few edge cases where cleaning the registry might yield some performance gains, if you've installed something that plugs into Windows somehow, doesn't work very well, and also doesn't uninstall itself properly. Most of these problems can be prevented in the first place by simply being more careful about what you install on your PC—after all, youshouldn't have to reinstall Windows regularly.

If you disagree with my assessment, I'd like to issue you this challenge: Before calling me out, why don't you be the first person to ever have real-world benchmarks proving that registry cleaners make a substantial difference in your system performance. I won't hold my breath.

What About Defragging the Registry?

Another claim you'll often read about the registry is that you need to defrag it regularly to keep your PC from being extremely slow—in fact, Microsoft provides thePageDefragutility for Windows XP to defragment your pagefile and registry. Windows 7 or Vista users will have to turn to a freeware utility likeAuslogics Registry Defragto keep their registry defragmented.

What most people don't realize, however, is that your registry is fully loaded into RAM when your system boots, meaning all reads and writes to the registry are done directly to memory, and then loaded to the disk later. So while you're going to gain some slight performance gain by making sure your registry isn't too fragmented, the reality is that your system isn't going to suddenly be blazing fast because you defragged your registry.

Geek Secrets: Figuring Out Registry Hacks

Over at the How-To Geek site, I've regularly found registry hacks and shared them with the world, and the one question I get all the time is: "how did you figure that out?". Today I'm finally going to share my secret with you, but you'll need to grab yourself a copy ofProcess Monitorbefore we get started.

Once you've popped open a Process Monitor window, you'll want to add a filter for the application that you're trying to monitor—for Windows settings like Control Panel, you'll need to use explorer.exe or mmc.exe most of the time. Once you've added the filter and cleared the log, you can monitor exactly what registry keys are accessed when you change a setting or bring up a feature. You can then stop the logging and examine the keys, which will often lead you to the exact registry key you're looking for, and in some cases, hidden features that you didn't realize were there.

Now that you've located a registry key, you can make a backup of the current keys, and then make changes to the values to see what happens—note that you should probably only do this on a test machine, since you could seriously break something by messing around in the registry.