All-optical switching is a technique in which a gate light pulse changes the transmission of a target light pulse without the detour via electronic signal processing. We take this to the quantum regime, where the incoming gate light pulse contains only one photon on average. The gate pulse is stored as a Rydberg excitation in an ultracold atomic gas using electromagnetically induced transparency. Rydberg blockade suppresses the transmission of the subsequent target pulse. Finally, the stored gate photon can be retrieved. A retrieved photon heralds successful storage. The corresponding postselected subensemble shows an extinction of 0.05. The single-photon switch offers many interesting perspectives ranging from quantum communication to quantum information processing.