The KTiOPO 4 (KTP) band structure and dielectric function are calculated on various levels of theory starting from density-functional calculations. Within the independent-particle approximation an electronic transport gap of 2.97 eV is obtained that widens to about 5.23 eV when quasiparticle effects are included using the GW approximation. The optical response is shown to be strongly anisotropic due to (i) the slight asymmetry of the TiO 6 octahedra in the (001) plane and (ii) their anisotropic distribution along the [001] and [100] directions. In addition, excitonic effects are very important: The solution of the Bethe-Salpeter equation indicates exciton binding energies of the order of 1.5 eV. Calculations that include both quasiparticle and excitonic effects are in good agreement with the measured reflectivity.