The present invention provides a gas generator and comprises an electrolytic cell and a water-blocking device. The electrolytic cell is for electrolyzing electrolyzed water to generate a gas mixture of hydrogen and oxygen. The electrolytic cell has an outlet for outputting the gas mixture of hydrogen and oxygen. The water-blocking device is set on the outlet for preventing the electrolyzed water from flowing out when the electrolytic cell is tilted by an angle. The invention will close the gas pathway by the water-blocking device when the gas generator topples, thereby avoiding the electrolyte-rich electrolyzed water to flow out.本發明提供一種氣體產生器,包含電解槽及阻水裝置。電解槽用以電解電解水而產生氫氧混合氣體,電解槽具有一出氣孔,用以輸出氫氧混合氣體。阻水裝置設置在出氣孔之上,用以當電解槽傾斜一傾斜角度後阻擋電解槽之電解水流出。本發明利用阻水裝置在氣體產生器發生傾倒時關閉氣體通道,藉以避免富含電解質之電解水流出。