Tailoring spin coupling to electric fields is central to spintronics and spin-based quantum information processing. We present an optimal micromagnet design that produces appropriate stray magnetic fields to mediate fast electrical spin manipulations in nanodevices. We quantify the practical requirements for spatial field inhomogeneity and tolerance for misalignment with spins, and propose a design scheme to improve the spin-rotation frequency (to exceed 50 MHz in GaAs nanostructures). We then validate our design by experiments in separate devices. Our results will open a route to rapidly control solid-state electron spins with limited lifetimes and to study coherent spin dynamics in solids.