The osmeterium is a defensive organ found in all papilionid larvae, in all stages. The organ is situated in the prothoracic segment and can be everted when the larva feels threatened. The everted organ resembles a fleshy forked tongue not unlike a snake tongue and this along with the large eye like spots on the body might be used to startle birds and small reptiles. The osmeterial organ remains inside the body in the thoracic region in an inverted position and is everted when the larva is disturbed in any way emitting a foul, disagreeable odor which serves to repel ants, small spiders and mantids.
The fine structure of the osmeterium of Papilio demoleus libanius Fruhstorfer has been studied and found to contain 3 types of specialised cells for synthesis, acid secretion, and storage of the osmeterial secretion.
The fine structure of the osmeterium gland of Papilio larvae consists of the following cell types.
- Ellipsoid gland cells have an extensively infolded basal plasma membrane, abundant ribosomes and whorls of smooth endoplasmic reticulum. The apical plasma membrane bears long microvilli extending into a mass of granular material containing electron-lucid cavities. Tangential slits occur in the epicuticle. These cells are presumed to be organic acid-secreting cells.
- Tubular arm cells contain heterogeneous, electron-dense inclusions, extensively-branched nuclei and large mitochondria sometimes distended with electron-dense material. The apical plasma membrane bears short microvilli. The inner, dense epicuticle forms a complex ramifying system. These glandular cells presumably synthesize and secrete the mature secretion.
Specific study of Papilio demoleus libanius Fruhstorfer shows the possible existence of a third type of cell
- Slack cells, loosely surround the ellipsoid gland cells. These cells possess papillae, well-developed, rough endoplasmic reticulum, and numerous secretory vacuoles of various sizes and electron density. They may function as storage cells.
The secretion of Papilio demodocus pre-final larval instar contains methyl 3-hydroxybutanoate, 3-hydroxybutanoic acid, α-pinene, myrcene, limonene, β-phellandrene, (Z)-ocimene, (E)-ocimene, β-caryophyllene, (E)-β-farnesene, and germacrene A, as well as a number of unidentified sesquiterpenoids. and that of its final instar contains 2-methylpropanoic acid, 2-methylbutanoic acid, and their methyl and ethyl esters as major constituents.
Volatile components of the secretion of Parnassius glacialis (Parnassiinae, Parnassiini) consisted of isobutyric acid, 2-methylbutyric acid, and their methyl esters. That of Sericinus montela (Parnassiinae, Zerynthiini) was characterized as monoterpene hydrocarbons comprising β-myrcene (major), α-pinene, sabinene, limonene, and β-phellandrene, and of Pachliopta aristolochiae (Papilioninae, Troidini) was composed of numerous sesquiterpene hydrocarbons, including α-himachalene, α-amorphene, and germacrene A, and a few oxygenated sesquiterpenoids.
Studies on osmeterial secretion makes it possible to classify the Papilionid species into two large categories on the basis of the chemical property of osmeterial secretion.
- One is a group in which the chemical constitution of osmeterial secretion of the last larval instar markedly differs in quality from those of the younger larvae. The results derived from Papilio protenor, P. demodocus  and other Papilio species (P. helenus, P. machaon, P. memnon, P. bianor, P. maccki, P. xuthus, etc., unpublished work) may assign the genus Papilio (tribe Papilionini) to this group, which can be termed 'heterogeneous type'.
- The genera Luehdorfia (tribe Zerynthiini), Graphium (tribe Graphiini) and Atrophaneura (tribe Troidini) apparently belong to the other group in which no qualitative change of osmeterial secretion occurs at the last larval ecdysis. This group can be designated as 'homogeneous type', which is further subdivisible into three types.
- Monoterpene - Luehdorfia (Zerynthiini, Parnassiinae)
- Sesquiterpene - Atrophaneura (Troidini, Papilionnae)
- Aliphatic acid and ester - Graphium (Graphiini, Papilioninae)
Eversion of the osmeterial gland is demonstrably effective in reducing predation by ants and small spiders, and its chemical constituents have been shown to repel or kill ants, and mantids.
- Chattopadhyay, J. 2011. The structure and defensive efficacy of glandular secretion of the larval osmeterium in Graphium agamemnon agamemnon Linnaeus, 1758 (Lepidoptera: Papilionidae).
- Eisner, T., and Meinwald, Y.C. 1965. The defensive secretions of a caterpillar (Papilio). Science, N.Y. 150: 1733-1735.
- Damman, H. 1986. The osmeterial glands of the swallowtail butterfly Eurytides Marcellus as a defense against natural enemies. Ecol.Entomol. 11: 261-265.
- Chow, Y.S. and Tsai, R.S. 1989. Protective chemicals in caterpillar survival. Experientia (Basel) 45 (4): 390-392.
- Crossley, A.C. and Waterhouse, D.F. 1969. The ultrastructure of the osmeterium and the nature of its secretion in Papilio larvae (lepidoptera). Tissue & Cell 1: 525-554.
- Lu, Chow-Chin; Yien Shing Chow (1991) Fine structure of the larval osmeterium of Papilio demoleus libanius (Lepidoptera: papilionidae). Ann. Entomol. Soc. Am. 84(3):294-302.
- Burger, B.V., Munro, Z., Roth, M., Spies, H.S.C., Truter, V. and Greetsema, H. 1985. Constituents of osmeterial secretion of prefinal instar larvae of citrus swallowtail, Papilio demodocus (Esper) (Lepidoptera: Papilionidae). J. Chem. Ecol. 11 (8): 1093-1114.
- Burger, B.V., Roth, M., Le Roux, M., Spies, H.S.C., Truter, V. and Geertsema, H. 1978. The chemical nature of the defensive larval secretion of the citrus Swallowtail, Papilio demodocus. J. Insect Physiol. 24: 803-805.
- Keiichi Honda, Nanao Hayashi. Chemical nature of larval osmeterial secretions of papilionid butterflies in the genera Parnassius, Sericinus and Pachliopta. Journal of Chemical Ecology June 1995, Volume 21, Issue 6, pp 859-867.
- HONDA K. 1980: Osmeterial secretions of papilionid larvae in the genera Luehdorfia, Graphium and Atrophaneura (Lepidoptera). Insect Biochem. 10: 583-588.
- HONDA, KEIICHI. Defensive potential of components of the larval osmeterial secretion of papilionid butterflies against ants. Physiological Entomology - Blackwell Publishing Ltd.  DO - 10.1111/j.1365-3032.1983.tb00346.x