The iron carbide Fe 7 C 3 exhibits two types of basic crystal structures, an orthorhombic ͑o-͒ form and a hexagonal ͑h-͒ one. First-principles calculations have been performed for the basic Fe 7 C 3 forms and for the related -Fe 3 C cementite phase. Accurate total-energy calculations show that the stability of Fe 7 C 3 is comparable to that of -Fe 3 C. The o-Fe 7 C 3 phase is more stable than the hexagonal one, in contrast to recent atomistic simulations. Furthermore, the calculations also show a rather low energy for a carbon vacancy in the o structure, which implies possible C deficiency in the lattice. Both Fe 7 C 3 phases are ferromagnetic metals. Electronic band-structure calculations show that all Fe atoms exhibit high-spin states with the majority of their 3d states being almost fully occupied. From an analysis of the structural and energetic properties, the formation of the o phase in steel treatment processes and of h form in carburization of ferrite is discussed.