We present the analytical solution to the diffraction integral that describes the Rayleigh length for a focused Gaussian beam with any value of a spherical truncating aperture. This exact solution is in precise agreement with numerical calculations for the light distribution in the near focal area. The solution arises under assumption of the paraxial approximation, which also provides the basis for the classical Rayleigh length definition. It will be shown that the non-paraxial regime can be included by adding an empirical term (Cnp) to the solution of the diffraction integral. This extends the validity of the expression to high numerical apertures (NA) up to n times 0.95, with n being the refractive index of the immersion medium. Thus, the entire practical range of NA, encountered in optical microscopy, is covered with a calculated error of less than 0.4% in the non-paraxial limit. This theoretical result is important in the design of optical instrumentation, where overall light efficiency in excitation and detection and spatial resolution must be optimised together.