SPEX (Spectropolarimeter for Planetary EXploration) is an innovative, compact instrument for spectropolarimetry, and in particular for detecting and characterizing aerosols in planetary atmospheres. With its åisebox-0.5ex~1-liter volume it is capable of full linear spectropolarimetry, without moving parts. The degree and angle of linear polarization of the incoming light is encoded in a sinusoidal modulation of the intensity spectrum by an achromatic quarter-wave retarder, an athermal multiple-order retarder and a polarizing beam-splitter in the entrance pupil. A single intensity spectrum thus provides the spectral dependence of the degree and angle of linear polarization. Polarimetry has proven to be an excellent tool to study microphysical properties (size, shape, composition) of atmospheric particles. Such information is essential to better understand the weather and climate of a planet. The current design of SPEX is tailored to study Martian dust and ice clouds from an orbiting platform: a compact module with 9 entrance pupils to simultaneously measure intensity spectra from 400 to 800 nm, in different directions along the flight direction (including two limb viewing directions). This way, both the intensity and polarization scattering phase functions of dust and cloud particles within a ground pixel are sampled while flying over it. We describe the optical and mechanical design of SPEX, and present performance simulations and initial breadboard measurements. Several flight opportunities exist for SPEX throughout the solar system: in orbit around Mars, Jupiter and its moons, Saturn and Titan, and the Earth.