First-principles study of cubic HfO2 with O and Hf vacancies was carried out with the plane-wave ultrasoft pseudopotential technique within the generalized gradient approximation (GGA). The crystal structure of cubic HfO2 with O and Hf vacancies was optimized. The band structure, electronic-state density, complex dielectric function, refractive index, extinction coefficient, complex conductivity function, loss function, absorption coefficient and optical reflectivity in pure, O vacancy and Hf vacancy cubic HfO2 were calculated. Compared to the pure cubic HfO2, we find that the O vacancy and Hf vacancy cubic HfO2 are some changes in electronic structure. The Fermi surface extends into the conduction band of the O vacancy cubic HfO2 and the Fermi surface extends into the valence band of the Hf vacancy cubic HfO2.