HCl + CaCO3 → CaCl2 + H2O + CO2
The carbon dioxide gas produced in this reaction can then be detected by bubbling it through limewater (a saturated solution of calcium hydroxide, Ca(OH)2). If carbon dioxide gas is present, it will react with the calcium hydroxide to form calcium carbonate, which appears as a milky white precipitate. The chemical equation for this reaction is:
Ca(OH)2 + CO2 → CaCO3 + H2O
Therefore, by adding hydrochloric acid to calcium carbonate and transferring the gas to limewater, you can test for the presence of carbon dioxide gas.