Cannabinoid-based therapies have long been used to treat pain, but there remain questions about their actual mechanisms and efficacy. From an evolutionary perspective, the cannabinoid system would appear to be highly conserved given that the most prevalent endogenous cannabinoid (endocannabinoid) transmitters, 2-arachidonyl glycerol and anandamide, have been found throughout the animal kingdom, at least in the species that have been analysed to date. This review will first examine recent findings regarding the potential conservation across invertebrates and chordates of the enzymes responsible for endocannabinoid synthesis and degradation and the receptors that these transmitters act on. Next, comparisons of how endocannabinoids modulate nociception will be examined for commonalities between vertebrates and invertebrates, with a focus on the medicinal leech . Evidence is presented that there are distinct, evolutionarily conserved anti-nociceptive and pro-nociceptive effects. The combined studies across various animal phyla demonstrate the utility of using comparative approaches to understand conserved mechanisms for modulating nociception. This article is part of the Theo Murphy meeting issue 'Evolution of mechanisms and behaviour important for pain'.