Baking soda is a versatile compound: It acts as an anti-acid, a leavening agent in baking, and helps extinguish fires by producing carbon dioxide when it reacts with acids.
Baking powder contains baking soda as one of its ingredients. When baking soda reacts with an acid like cream of tartar or vinegar, carbon dioxide gas is produced, causing the dough to rise. This reaction is the basis for baking soda's role in baking powder. The chemical equation is:
\[
NaHCO_3 (aq) + H_2C_4H_4O_6 (aq) \rightarrow NaKC_4H_4O_6 (aq) + CO_2 (g) + H_2O (l)
\]
Here, the acid-base reaction produces carbon dioxide that helps in leavening the dough.