In view of low measurement accuracy of methane concentration measurement instrument based on gas chromatography, a zero and linear temperature compensation algorithm based on principle of infrared spectrum absorption was proposed. A kind of infrared methane concentration measurement instrument which has high precision and can achieve real-time online detection was designed based on the temperature compensation algorithm. Experimental results show that, before the temperature compensation, the larger the temperature changes, the greater the measurement error of the methane concentration will be, and the error is in the range of 3%-11.5%; after the temperature compensation, measurement value of methane concentration has minor changes with the ambient temperature, and the error is in the range of 0-2.5%.