A breathing device with carbon dioxide compensation function, which comprises: an air source pipeline, a low pressure oxygen source pipeline, a high pressure oxygen source pipeline, a carbon dioxide source pipeline, a gas supply pipeline all of which are set in a ventilator; and a breathing pipeline which is set outside the ventilator, wherein: air from an air source enters the ventilator through the air source pipeline, low pressure oxygen from a low pressure oxygen source is mixed with the air in the air source pipeline through the low pressure oxygen source pipeline; mixed breathing gas enters the gas supply pipeline which is located behind a third check valve, is transmitted outside the ventilator through the gas supply pipeline, and is inhaled by a user through the breathing pipeline; high pressure oxygen from a high pressure oxygen source enters the ventilator through the high pressure oxygen source pipeline, carbon dioxide gas from a carbon dioxide source and the high pressure oxygen in the high pressure oxygen source pipeline are mixed through the carbon dioxide source pipeline and form therapeutic gas; the therapeutic gas enters the gas supply pipeline, is transmitted outside the ventilator through the gas supply pipeline, and is inhaled by the user through the breathing pipeline for treatment, wherein the carbon dioxide gas is mixed with the high pressure oxygen in a preset ratio, so as to adjust a content of carbon dioxide in a body of the user; a third filter, a first flow control valve, and a directional valve are provided on the high pressure oxygen source pipeline, a second pressure sensor is located between the third filter and the first flow control valve; when the directional valve is opened positively, the high pressure oxygen enters the gas supply pipeline through the third filter, the first flow control valve, and the directional valve on the high pressure oxygen source pipeline; a fourth filter, a third pressure sensor and a second flow control valve are provided on the carbon dioxide source pipeline in sequence, the carbon dioxide gas and the high pressure oxygen are mixed through the fourth filter, the third pressure sensor and the second flow control valve on the carbon dioxide source pipeline and form therapeutic gas, the therapeutic gas enters the gas supply pipeline; the third pressure sensor measures a pressure of the carbon dioxide gas in the carbon dioxide source pipeline; a ratio of oxygen to the carbon dioxide gas in the therapeutic gas is adjusted through adjusting a flow of the high pressure oxygen and the carbon dioxide gas by the first flow control valve and the second flow control valve, so as to allow the ratio reaches a preset value. air from an air source enters the ventilator through the air source pipeline, low pressure oxygen from a low pressure oxygen source is mixed with the air in the air source pipeline through the low pressure oxygen source pipeline; mixed breathing gas enters the gas supply pipeline which is located behind a third check valve, is transmitted outside the ventilator through the gas supply pipeline, and is inhaled by a user through the breathing pipeline; high pressure oxygen from a high pressure oxygen source enters the ventilator through the high pressure oxygen source pipeline, carbon dioxide gas from a carbon dioxide source and the high pressure oxygen in the high pressure oxygen source pipeline are mixed through the carbon dioxide source pipeline and form therapeutic gas; the therapeutic gas enters the gas supply pipeline, is transmitted outside the ventilator through the gas supply pipeline, and is inhaled by the user through the breathing pipeline for treatment, wherein the carbon dioxide gas is mixed with the high pressure oxygen in a preset ratio, so as to adjust a content of carbon dioxide in a body of the user; a third filter, a first flow control valve, and a directional valve are provided on the high pressure oxygen source pipeline, a second pressure sensor is located between the third filter and the first flow control valve; when the directional valve is opened positively, the high pressure oxygen enters the gas supply pipeline through the third filter, the first flow control valve, and the directional valve on the high pressure oxygen source pipeline; a fourth filter, a third pressure sensor and a second flow control valve are provided on the carbon dioxide source pipeline in sequence, the carbon dioxide gas and the high pressure oxygen are mixed through the fourth filter, the third pressure sensor and the second flow control valve on the carbon dioxide source pipeline and form therapeutic gas, the therapeutic gas enters the gas supply pipeline; the third pressure sensor measures a pressure of the carbon dioxide gas in the carbon dioxide source pipeline; a ratio of oxygen to the carbon dioxide gas in the therapeutic gas is adjusted through adjusting a flow of the high pressure oxygen and the carbon dioxide gas by the first flow control valve and the second flow control valve, so as to allow the ratio reaches a preset value.