We put forward reverse engineering protocols to shape in time the components of the magnetic field to manipulate a single spin, two independent spins with different gyromagnetic factors, and two interacting spins in short amount of times. We also use these techniques to setup protocols robust against the exact knowledge of the gyromagnetic factors for the one spin problem, or to generate entangled states for two or more spins coupled by dipole-dipole interactions.