Onion is an expectorant, meaning it helps to clear mucus. Expectorants lubricate your airways and help make a cough productive. A productive cough brings up excess mucus, allowing it to be cleared from the body. This helps you to recover more quickly from a cold, and prevent it from becoming worse.