We calculate the mesoscopic fluctuations of the magnetic anisotropy of ferromagnetic nanoparticles. A microscopic spin-orbit Hamiltonian considered as a perturbation of the much stronger exchange interaction first yields an explicit expression for the anisotropy tensor. Then, assuming a simple random matrix model for the spin-orbit coupling allows us to describe the fluctuation of such a tensor. In the case of uniaxial anisotropy, we calculate the distribution of the anisotropy constant for a given number of electrons, and its variation upon increasing this number by one. The magnitude of the latter is sufficient to account for the experimental data.