  Measuring the state of a quantum system is a fundamental process in quantum
mechanics and plays an essential role in quantum information and quantum
technologies. One method to measure a quantum observable is to sort the system
in different spatial modes according to the measured value, followed by
single-particle detectors on each mode. Examples of quantum sorters are
polarizing beam-splitters (PBS) -- which direct photons according to their
polarization -- and Stern-Gerlach devices. Here we propose a general scheme to
sort a quantum system according to the value of any $d$-dimensional degree of
freedom, such as spin, orbital angular momentum (OAM), wavelength etc. Our
scheme is universal, works at the single-particle level and has a theoretical
efficiency of 100\%. As an application we design an efficient OAM sorter
consisting of a single multi-path interferometer which is suitable for a
photonic chip implementation.
