The present invention provides a gas generator and comprises an electrolytic cell, a gas pathway, and an anti-static device. The electrolytic cell is for electrolyzing electrolyzed water to generate a gas with hydrogen. The gas generated from the electrolytic cell is transferred by the gas pathway. The anti-static device is set in the gas generator for reducing or eliminating the static electricity. The present invention uses the anti-static device to prevent the gas with hydrogen in the gas pathway from exploding by the static electricity, thereby providing a safe gas generator.