Single-crystal elastic constants and mechanical hardness of covalent and ionic crystals have been studied using first-principles calculations.The results show that the hardness is dominated by the softest elastic mode,not by the averaged elastic moduli as generally assumed.It reveals that the mechanical stability and anisotropy play an important role in determining the hardness of materials.The concept is then employed in designing hard alloys.By strengthening the softest elastic mode of tungsten carbide,which is the primary component in industrial hard alloys,we show that the carbide can be made even harder by alloying with nitrogen or rhenium via Fermi-level tuning.