First-principles calculations are presented for stable and metastable intermetallic phases of TiNi shape memory alloys. Density functional theory (DFT) is applied to predict the electronically preferred structures of the Ti2Ni3 phases. In the DFT analysis, two modifications of Ti2Ni3 phase are distinguished, the low-temperature orthorhombic and the high-temperature tetragonal structure. Enthalpies of formation at 0K and atomic coordinates of the unit cells of Ti2Ni3 modifications are reported. Based on refined atom positions, the enthalpy of formation at 0K of cubic TiNi (B2), hexagonal TiNi3 (D024) and rhombohedral Ti3Ni4 (R-3 phase) are optimized and compared to existing data from literature. Lattice constants of the investigated phases are consistent with experimental measurements.