In tip 2020 and tip 1101, I described how to compact the registry for Windows NT 4.0.

For Windows 2000, you can create an ERD using the NTBackup applet and checking the Also backup.... box. Then use these same procedures, substituting %SystemRoot%\Repair\RegBack for %SystemRoot%\Repair.

For Windows XP, a small shareware application, RegCompact.NET, can compact your registry at restart.