The NO x submodels currently used in the CFD-based simulation of engines have been developed for conditions where homogeneous and stoichiometric mixtures of fuel and air are burned. Such conditions apply well for spark ignition engines (SIE) but not for compression ignition engines (CIE), where combustion takes place in a highly heterogeneous environment. As a consequence, current NO x submodels do not satisfactorily describe the fate of nitrogen oxides in CIE. The aim of this work was to determine, by detailed chemical kinetic investigation, the mechanisms leading to in-cylinder NO x in low-and medium-speed CIE and to develop a more accurate submodel for the prediction of NO x in CIE by means of CFD. Calculations at constant pressure (1-150 bar) and constant temperature (1500-2200 °C) under ideal plug flow conditions show that, relative to the proportion of NO, the proportion of NO 2 in NO x is negligible and that the formation and destruction of NO occurs mainly via 10 reactions. These reactions can be organized into three NO mechanisms: thermal, N 2 O intermediate, and N 2 O extension, the latter being a set of five reactions that oxidize N 2 O to NO via NH and HNO intermediates. To our knowledge, the importance of the N 2 O-extension mechanism is reported here for the first time. An improved NO x submodel was developed taking into account all three mechanisms, after introducing approximations relevant to CIE. According to our kinetic investigations, partial equilibrium approximation can be applied to O, OH, and H and a quasi-steady-state approximation to N 2 O, N, NH, and HNO. The performance of the improved submodel is illustrated by comparing its NO x predictions with those of a detailed kinetic scheme and a NO submodel currently used in CFD. The comparison shows that the improved submodel always produces more accurate predictions of NO x than does the current submodel.