A systematic theoretical study is presented for the structural and electronic properties of HfB 2 with AlB 2 structure under pressure ranging from 0 to 240GPa in the framework of density functional theory. The results at zero pressure are in good agreement with the available theoretical and experimental values. The pressure dependence of structural property shows that the effect of pressure is little on the structure of HfB 2 . The density of states (DOS) of HfB 2 versus pressure is also successfully calculated. We find high pressure greatly changes the profile of the DOS, but it hardly changes the DOS value at Fermi level. Meanwhile, the Mulliken population analyses are investigated. It is suggested that as the pressure increases, a number of charge transfer from Hf to B atoms.