A gas generator is provided in which the filter life is prolonged and the pressure regulating valve is thereby protected for a prolonged periods. The gas generator is intended for electrolyzing an electrolyte in an electrolytic cell to generate a gas or gases and comprises at least one absorber for absorbing an unnecessary by-products generated from the gas generator, a filter for removing the mist generated from the absorber, and at least one pressure regulating valve for adjusting the pressure in the electrolytic cell, wherein the filter is inserted downstream from the absorber and, further, the pressure regulating valve is disposed downstream from the filter.