Abstract We present radiative transfer simulations for blue kilonovae hours after neutron star (NS) mergers by performing detailed opacity calculations for the first time. We calculate atomic structures and opacities of highly ionized elements (up to the 10th ionization) with atomic number Z = 20–56. We find that the bound–bound transitions of heavy elements are the dominant source of the opacities in the early phase (t < 1 day after the merger) and that the ions with a half-closed electron shell provide the highest contributions. The Planck mean opacity for lanthanide-free ejecta (with electron fraction of Y e = 0.30–0.40) can only reach around at t = 0.1 days, whereas that increases up to at t = 1 day. The spherical ejecta model with an ejecta mass of M ej = 0.05 M ⊙ gives the bolometric luminosity of at t ∼ 0.1 days. We confirm that the existing bolometric and multicolor data of GW170817 can be naturally explained by the purely radioactive model. The expected early UV signals reach 20.5 mag at t ∼ 4.3 hr for sources even at 200 Mpc, which is detectable by the facilities such as Swift and the Ultraviolet Transient Astronomy Satellite (ULTRASAT). The early-phase luminosity is sensitive to the structure of the outer ejecta, as also pointed out by Kasen et al. Therefore, the early UV observations give strong constraints on the structure of the outer ejecta and the presence of a heating source besides r-process nuclei.