Chemical leaveners, like baking powder and baking soda, can lose their potency over time. This is especially true when they are not stored in airtight containers. And old baking powder and soda can cause flat cakes, dense or flat cookies Tthere is a very simple test that you can do to see if that nearly-forgotten box of baking soda is still good enough to bake with.
For baking soda put a teaspoon into a 1/2 cup vinegar in a small bowl. You should see lots of fizzing. Otherwise it needs to be replaced. It has lost it’s potency. Always keep these leaveners in a Tupperware or some other airtight containers for the best shelf life.
For Baking Powder put a half cup of warm water into a small bowl and add a teaspoon of baking powder. The mixture should make a fizzing noise and, after a moment, the baking powder will begin to fizz and the water will become very cloudy with tiny bubbles. The more bubbles, the fresher the baking powder.