A biogas generator includes a bathroom, a vacuum system and a fermentation system, the bathroom includes an infrared sensor arranged on a wall, a pedestal pan and an automatic cleaning device, the technical points are as follows: the fermentation system includes a feed tank, a fermentation tank, a discharge tank, a biogas bag, a waste material pond, a first extrusion device, a secondary extrusion device, a packer, a liquid storage tank, and an air cleaning unit arranged on the secondary extrusion device; the bottom of the fermentation tank is provided with a heater and a temperature sensor, the top of the fermentation tank is provided with an air pressure sensor, a mesh-like valve is arranged between the fermentation tank and the feed tank; a drying apparatus and a purifying controller are arranged between the biogas bag and the fermentation tank, a pneumatic valve III is arranged between the waste material pond and the discharge tank, the liquid storage tank is provided with one pair of liquid level sensors, the bottom of the liquid storage tank is provided with a discharge port, and a pneumatic valve IV is arranged on the discharge port. The biogas generator fundamentally solves the problems that in the prior art bathroom stool and urine are not conducive to treatment, a lot of organic matters are not fully used, and the like.