We study the effects of a magnetic field on the chaotic dynamics of a string with endpoints on the boundary of an asymptotically AdS 5 space with black hole. We study Poincaré sections and compute the Lyapunov exponents for the string perturbed from the static configuration, for two different orientations, with position of the endpoints on the boundary orthogonal and parallel to the magnetic field. We find that the magnetic field stabilizes the string dynamics, with the largest Lyapunov exponent remaining below the Maldacena-Shenker-Stanford bound.