Cubic MX-type carbonitrides is an important strengthening phase in martensite steels, and its structural stability is very important to the properties of steel. In this paper, formation energy and structure stability of NbC crystal structure with the substitution of Nb by V and C by N, respectively, were investigated through using Ab initio calculation method based on density functional theory (DFT). Molecular formulas with the different substitution ratios are labeled as (Nb3, V)C4，(Nb2, V2)C4，(Nb, V3)C4，Nb4(C3, N)，Nb4(C2, N2) and Nb4(C, N3), respectively. It is found that the symmetry of the original crystal remains unchanged after structure optimization, except for (Nb2, V2)C4 and Nb4(C2, N2). The result show that the more N atoms substitution is in C lattice sites, the higher is the stability of carbonitrides. According to formation energy, the stability of (Nb, V3)C4 is better than that of (Nb3, V)C4. This result is consistent with known experimental data.