THERE are many absorption lines in the visible and near-infrared spectra of stars located on the far side of diffuse interstellar clouds. The origin of these 'diffuse interstellar bands' (DIBs) has remained an unanswered question since their discovery almost 70 years ago1,2. There are now over 100 known bands1,3-6 and it is clear from the range of line widths, depths and shapes that the lines are unlikely to come from a single 'carrier'. Many of the proposed carriers, such as gas-phase carbon chains7, fullerenes8 and dust grains9, fail in having ultraviolet absorption lines where none has yet been observed in the stellar spectra. Polycyclic aromatic species such as C16H10+ (ref. 10) and C10H8 (ref. 11) were recently claimed to be good candidates for carriers of some of the DIBs. Here we present laboratory evidence that highly unsaturated hydrocarbons with carbon numbers 6-12 may be the carriers of some of the DIBs in the range 480-1,000 nm. We deposit mass-selected molecules in a neon matrix at 5 K and measure their near-infrared, visible and ultraviolet spectra. Not only do these species have visible and near-infrared lines corresponding to fifteen DIBs, but they also show no absorption lines in the ultraviolet, consistent with astronomical observations.