We initiate the homotopical study of racks and quandles, two algebraic structures that govern knot theory and related braided structures in algebra and geometry. We prove analogs of Milnor's theorem on free groups for these theories and their pointed variants, identifying the homotopy types of the free racks and free quandles on spaces of generators. These results allow us to complete the stable classification of racks and quandles by identifying the ring spectra that model their stable homotopy theories. As an application, we show that the stable homotopy of a knot quandle is, in general, more complicated than what any Wirtinger presentation coming from a diagram predicts.