Ammonia is a weak alkali that reacts reversibly with water and alters the pH of the solution into base condition.
:NH + HO  NH + OH
On the other hand, if sodium hydroxide is added to adjust the pH of the solution to alkali, the color change occurs faster than when the ammonia is added, as sodium hydroxide is a highly reactive compound.
:NaOH  Na + OH
When dry ice is added to water, it sublimes to carbon dioxide gas rapidly because the solution's temperature is warmer than the dry ice (-78.5 °C or -109.3°F). The carbon dioxide gas can be observed as bubbles or clouds above the solution. Because the temperature of the gas is so cold, the water vapor contained in the air above the water condenses into small water droplets, or clouds, suspended in the carbon dioxide gas.
:CO  CO
However, some of the dry ice molecules remain in the solution and react reversibly with water molecules to form an acidic solution via the production of hydrogen ions.
:CO + HO  HCO + H</sub>
When the acidic solution is mixed together with the alkali present in the solution, the solution, overall, becomes neutral.
:HCO + H + NH + OH    NH + HCO + HO       (addition of ammonia)
:HCO + H + Na + OH    Na + HCO + HO          (addition of sodium hydroxide)
The overall chemical equation for neutralization of an aqueous solution of NaOH and carbonic acid is given by:
:2 NaOH + CO  NaCO + HO
The color of the solution arises due to the pH indicator. The color of the ammonia-and-water solution at the beginning of the experiment indicates that the solution is alkaline. However, once the dry ice is added, the solution becomes less alkaline as neutralization occurs which causes the color to slowly change as more hydrogen ions are continuously produced from the carbonic acid.