This paper presents the characterization of the in-flight beams, the beam window functions, and the associated uncertainties for the Planck Low Frequency Instrument (LFI). Knowledge of the beam profiles is necessary for determining the transfer function to go from the observed to the actual sky anisotropy power spectrum. The main beam distortions affect the beam window function, complicating the reconstruction of the anisotropy power spectrum at high multipoles, whereas the sidelobes affect the low and intermediate multipoles. The in-flight assessment of the LFI main beams relies on the measurements performed during Jupiter observations. By stacking the data from multiple Jupiter transits, the main beam profiles are measured down to -20 dB at 30 and 44 GHz, and down to -25 dB at 70 GHz. The main beam solid angles are determined to better than 0.2% at each LFI frequency band. The Planck pre-launch optical model is conveniently tuned to characterize the main beams independently of any noise effects. This approach provides an optical model whose beams fully reproduce the measurements in the main beam region, but also allows a description of the beams at power levels lower than can be achieved by the Jupiter measurements themselves. The agreement between the simulated beams and the measured beams is better than 1% at each LFI frequency band. The simulated beams are used for the computation of the window functions for the effective beams. The error budget for the window functions is estimated from both main beam and sidelobe contributions, and accounts for the radiometer bandshapes. The total uncertainties in the effective beam window functions are: 2% and 1.2% at 30 and 44 GHz, respectively (at l approximate to 600), and 0.7% at 70 GHz (at l approximate to 1000).