We apply the first-principles calculations to investigate the structure, mechanical, and thermodynamic properties of WB12 and TiB12 under high pressure (0–100 GPa). The calculated results show that WB12 and TiB12 are thermodynamically stable at the 0 GPa or high pressure. WB12 is more thermodynamically stable than TiB12. In particular, the calculated Vickers hardness of WB12 and TiB12 at the ground state is 29.9 GPa and 43.2 GPa, respectively, indicating that TiB12 is a potential superhard material. With increasing pressure, the calculated elastic modulus of WB12 and TiB12 increases gradually. The calculated electronic structure shows that the high Vickers hardness and elastic properties of WB12 and TiB12 derive from the 3D network B–B covalent bonds. In addition, the calculated Debye temperature at the ground state is 927 K for WB12 and 1339 K for TiB12, respectively. With increasing pressure, the calculated Debye temperature of WB12 and TiB12 increases gradually. Our work shows that TiB12 not only exhibits high hardness but also shows better thermodynamic properties in comparison with WB12.