A device for measuring the consumption of oxygen and the consumption of carbon dioxide by a subject comprises an air collecting member for collecting the flow of air breathed, a flowmeter for measuring the flow rate of air exhaled by the subject, and a sampling line for sampling a portion of the flow of air exhaled by the subject. A pump, with substantially constant capacity draws the aforesaid portion of flow of air into the sampling line. A mixing chamber is interposed in the sampling line for collecting and mixing together flows of air exhaled by the subject in a number of breathing cycles. Means for sensing the concentration of oxygen and means for sensing the concentration of carbon dioxide are arranged in the sampling line. The pump is with constant capacity, but is controlled in a PWM mode in order to simulate a capacity that varies in proportion to the variation of the flow during the breathing cycle so as to render measurement of the consumption of oxygen reliable even though the mixing chamber does not receive the entire flow exhaled by the subject. The device further comprises a bypass line of the mixing chamber, through which the flow of air can pass without passing through the mixing chamber. A valve for selecting the measuring mode can be displaced selectively into two different positions, to get the flow of air that traverses the sampling line to converge either through the mixing chamber, when an average measurement is to be made of the consumption of oxygen by the subject in the course of a number of breathing cycles, or through said bypass line, when an instantaneous measurement is to be made of the consumption of oxygen by the subject in each breathing cycle.