Snells law, which encompasses both refraction and total internal reflection (TIR), provides the foundation for ray optics and all lens-based instruments, from microscopes to telescopes. Refraction results when light crosses the interface between media of different refractive index, the dimensionless number that captures how much a medium retards the propagation of light. In this work, we show that the motion of self-propelled particles moving across a drag discontinuity is governed by an analogous Snells law, allowing for swimmer ray optics. We derive a variant of Snells law for neutral swimmers moving across media of different viscosities. Just as the ratio of refractive indexes sets the path of a light ray, the ratio of viscosities is shown to determine the trajectories of swimmers. We find that the magnitude of refraction depends on the swimmers shape, specifically the aspect ratio, as analogous to the wavelength of light. This enables the demixing of a polymorphic, many-shaped, beam of swimmers into distinct monomorphic, single-shaped, beams through a viscosity prism. In turn, beams of monomorphic swimmers can be focused by spherical and gradient viscosity lenses. Completing the analogy, we show that the shape-dependence of the TIR critical angle can be used to create swimmer traps. Such analogies to ray optics suggest a universe of new devices for sorting, concentrating, and analyzing microscopic swimmers is possible.