A novel periodic magnetic field PMF optic is shown to act as a prism, lens, and polarizer for neutrons and particles with a magnetic dipole moment. The PMF has a two-dimensional field in the axial direction of neutron propagation. The PMF alternating magnetic field polarity provides strong gradients that cause separation of neutrons by wavelength axially and by spin state transversely. The spin-up neutrons exit the PMF with their magnetic spins aligned parallel to the PMF magnetic field, and are deflected upward and line focus at a fixed vertical height, proportional to the PMF period, at a downstream focal distance that increases with neutron energy. The PMF has no attenuation by absorption or scatter, as with material prisms or crystal monochromators. Embodiments of the PMF include neutron spectrometer or monochromator, and applications include neutron small angle scattering, crystallography, residual stress analysis, cross section measurements, and reflectometry. Presented are theory, experimental results, computer simulation, applications of the PMF, and comparison of its performance to Stern–Gerlach gradient devices and compound material and magnetic refractive prisms.