Cleaning Existing Residue
Rinse the dispenser's nozzle under warm water. Shaving cream is designed to be washed off with water, and this can unclog most obstructions.
Wipe down nearby surfaces with a damp rag. Most shaving cream residue often wipes off easily, but residue that has been sitting for several months may not come off with water alone.
Saturate a cotton swab with white vinegar and clean off any remaining nozzle or countertop gunk. After the shaving cream dries up, most of the remaining residue is a form of soap scum. White vinegar cuts through soap scum.
Poke the nozzle's hole with a needle or toothpick. If you're unable to work a cotton swab into the dispenser's nozzle, a sharp object can cut through blockage.
Preventing Future Residue
Cup your hand close to the dispenser's nozzle when using the shaving cream. When the shaving cream squirts out, it can spray residue on nearby items if you don't keep your hand close.
Wipe off excess shaving cream with your hand. Don't let the residue sit on the nozzle and drip down the dispenser. It's easiest to wipe off shaving cream while it is still foamy and wet.
Rinse the shaving cream dispenser with water as needed for larger shaving cream drips. With these preventative measures, you'll ensure the dispenser stays clean longer.