It’s possible to configure Outlook to automatically compact the pst every time you close Outlook. I don’t recommend doing it (or emptying the deleted folder on exit) as it can lengthen the time it takes Outlook to shutdown and if Outlook is forced to close during the compaction process the data file could become corrupt.
However, this can be useful to users who deal with sensitive data and need to ensure messages can’t be recovered as compacting removes all traces of deleted messages, making it impossible to recover the mail.
Understanding Deletion and Compaction
After you delete messages and other Outlook items then empty the Deleted Item folder, the deleted items are removed from the index so Outlook doesn’t display them but they are left in the data file. The space used by these deleted messages is often referred to as “white space”. Until Outlook recovers this space by compacting the data file, it may be possible to recover deleted messages using recovery software.
Outlook will automatically compact the data file when the “white space” reaches 20% of the data file’s size and the computer is idle. Because it runs as a background service, it can take days for Outlook to finish compacting the pst file. (If you leave Outlook open when the computer is running it will have more idle time to compact the data file.)
If you deleted a lot of messages and don’t want to wait for Outlook to get around to it, you can recover the free space by running Compact Now. To do this, right-click on the top-level of the data file and choose Properties, then click the Advanced button and Compact Now. Keep in mind that it can take a long time to compact a large data file.
If you want to force Outlook to return this free space every time that you close Outlook, you can add PSTNullFreeOnClose to the registry.
Press Windows key + R and type regedit in the Run dialog then press Enter to open the registry editor.
- Browse to the appropriate key for your version of Outlook.
- If the PST subkey does not exist, create it.
- Right click on PST key and choose New, DWORD.
- Type (or paste) PSTNullFreeOnClose as the Name.
- Double click on it and enter 1 as the Value.
For Outlook 2010:
DWORD: PSTNullFreeOnClose Value Data: 1 = compact on close, 0 = don’t compact
This key was introduced in an update for Outlook 2000 and works in all versions of Outlook that are updated with the latest service pack.
This key compacts both pst and ost files. With the value set to 1, deleted data is removed when you close Outlook. When it’s set to 0 or deleted, the data file will not be compacted on close.
Note that the first time you close Outlook after making this change, it may take a long time for Outlook to close.
Doit It For Me
If you don’t want to edit the registry, we have reg files you can use.
OL2000: New Outlook 2000 Feature Removes Deleted Data from .pst and .ost Files
Outlook 2007 improvements in the February 2009 cumulative update
After installing Office 2007 SP2, Outlook takes a long time to close and Outlook.exe remains running in the background