The linear and nonlinear optical (NLO) properties of the paraelectric and ferroelectric (FE) phases of lithium tantalate crystals were calculated using a first-principles approach based on density functional theory with the generalized gradient approximation. We present our results for the structural parameters, the imaginary and real parts of the frequency-dependent linear optical response, optical functions such as the spectral reflectivity, the absorption coefficient and the electron energy-loss spectrum. A simple scissors operator is applied to adjust the energy gap from calculations to match the experimental value. In the FE phase, we also study the NLO susceptibilities and calculate the NLO susceptibility tensor. LiTaO3 displays a good NLO effect. The results are compared with the theoretical calculations and available experimental data.