The present invention provides a gas generator and comprises an electrolytic device, a condensing filter device, and a cooling device. The electrolytic device is configured for electrolyzing electrolyzed water to generate hydrogen. The condensing filter device is coupled to the electrolytic device for receiving and filtering the hydrogen generated by the electrolytic device. The cooling device comprises a cooling sheet and a cooling fan, wherein the cooling sheet is configured on the condensing filter device, and the cooling fan is configured for driving air to flow through the cooling sheet to cool the condensing filter device. The present invention uses the condensing filter device and the cooling device for cooling the generated gas and the component that gas passes through, so that a stable operating temperature is maintaining. Therefore, the possibility of the component damage by high temperature and humidity is reduced.