The odour of acids has a distinct quality that is perceived as sharp, pungent and often irritating. How acidity is sensed and translated into an appropriate behavioural response is poorly understood. Here we describe a functionally segregated population of olfactory sensory neurons in the fruitfly, Drosophila melanogaster, that are highly selective for acidity. These olfactory sensory neurons express IR64a, a member of the recently identified ionotropic receptor (IR) family of putative olfactory receptors. In vivo calcium imaging showed that IR64a+ neurons projecting to the DC4 glomerulus in the antennal lobe are specifically activated by acids. Flies in which the function of IR64a+ neurons or the IR64a gene is disrupted had defects in acid-evoked physiological and behavioural responses, but their responses to non-acidic odorants remained unaffected. Furthermore, artificial stimulation of IR64a+ neurons elicited avoidance responses. Taken together, these results identify cellular and molecular substrates for acid detection in the Drosophila olfactory system and support a labelled-line mode of acidity coding at the periphery.