This paper presents the characterization of the in-flight beams, the beam window functions and the associated errors for the Planck Low Frequency Instrument (LFI). Knowledge of the beam profiles is the key to determining their imprint on the transfer function 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 relied on the measurements performed during Jupiter observations. By stacking the data from 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. To ensure a characterization of the main beam free from the radiometer noise, a dedicated tuning on the Planck pre-launch optical model is performed. This approach provides an optical model whose beams fully reproduce the measurements in the main beam region, but also allow us to describe the beams at power levels lower than can be reached by the Jupiter measurements themselves. The agreement between the simulated beams and the scanning 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 in the window functions was estimated considering both main beam and sidelobe contributions, as well as taking into account the radiometer bandshapes. The total uncertainties in the effective beam window functions are: (at ell = 600) 2% and 1.2% at 30 and 44 GHz, respectively; and at ell = 1000, 0.7% at 70 GHz.