We analytically study the effect of magnetic field in a holographic superconductor by using Sturm–Liouville method. We estimate the coefficient of proportionality at critical temperature and find its dependence on bulk magnetic field. By exploring the phase diagrams of critical temperature and magnetic field for various condensates, we conclude that the existence of critical magnetic field is a general feature in holographic superconductors. We also study the quantum phase transition at zero temperature and find that the critical charge density increases linearly with the condensate dimension.