The optical constants of electron-beam evaporated boron from 6.8 to 900 eV were calculated through transmittance measurements of boron thin films deposited onto carbon-coated microgrids or LiF substrates in ultrahigh-vacuum conditions. In the low-energy part of the spectrum the measurements were performed in situ on freshly deposited samples, whereas in the high-energy range the samples were exposed to the atmosphere before the measurements. The extinction coefficient was calculated directly from the transmittance data, and a Kramers-Kronig analysis that combined the current data with data from the literature was performed to determine the dispersive part of the index of refraction. Finally, two different sum-rule tests were performed that indicated the good consistency of the data.