When hot exhaust gas is mixed with inlet air, the charge to a diesel engine is modi-fied in different ways: the charge temperature increases, the total charge mass is re-duced and the charge composition changes. This paper is concerned with the residual gas fraction that is usually determined by straight CO2 measurement in a sample of gas extracted from a cylinder during the compression stroke. A general zero-dimensional model for calculating the residual gas fraction in reciprocating internal combustion engines has been formulated. The model accounts for both the trapped gas in the cylin-der at top dead center and the back-flow of exhaust gas into the cylinder during the valve overlap period. The effect of EGR introduction has been discussed.