Using the first-principles calculations, the structural features, mechanical properties, formation enthalpies, electronic properties and hardness of osmium carbides with various stoichometries have been investigated systematically. The structural stability, thermodynamic stability together with mechanical stability show that Re 2 N−Os 2 C, OsB 2 −OsC 2 , trigonal P3̅ m1 OsC 2 , trigonal P3̅ m1 OsC 3 , orthorhombic Cmmm OsC 4 and Ru 2 Ge 3 −Os 2 C 3 are the most stable structure for each kind of compounds. But, OsB 2 −OsC 2 and Ru 2 Ge 3 −Os 2 C 3 are dynamically unstable based on the calculation of phonon dispersion. The formation enthalpies under high pressure indicate that the Re 2 N−Os 2 C, P3̅ m1 OsC 3 , Cmmm OsC 4 and Os 2 Si 3 −Os 2 C 3 (P4c2) have structural stabilities in the entire range of pressure. While for OsC 2 , there is a high pressure phase transition exists above 40 GPa. In addition, all the studied osmium carbides exhibit metallic behavior and strong covalent bonding. According to the calculated Vicker hardness based on a semiempirical method, we found that the OsC 4 with Cmmm space group has the largest hardness value (28.4 GPa). Combined with its largest shear modulus and Yong's modulus, smallest Poission's ratio and low B/G ratio, we predict it is a potential superhard material. By the comparison between the crystal structure of OsC 2 and OsC 3 , it is found that the increased C−C bonds in a cell increase their hardness, whereas the ionicity Os−Os bonds are unfavorable.