[2] The pupal stage may last weeks, months, or even years, depending on temperature and the species of insect.
[citation needed] Prior to emergence, the adult inside the pupal exoskeleton is termed pharate.
Another means of defense by pupae of other species is the capability of making sounds or vibrations to scare potential predators.
When the caterpillar is fully grown, it makes a button of silk which it uses to fasten its body to a leaf or a twig.
Most chrysalides are attached to a surface by a touch fastener-like arrangement of a silken pad spun by the caterpillar, usually cemented to the underside of a perch, and the cremastral hook or hooks protruding from the rear of the chrysalis or cremaster at the tip of the pupal abdomen by which the caterpillar fixes itself to the pad of silk.
However, some butterfly pupae are capable of moving the abdominal segments to produce sounds or to scare away potential predators.
[14] Having emerged from the chrysalis, the butterfly will usually sit on the empty shell in order to expand and harden its wings.
However, if the chrysalis was near the ground (such as if it fell off from its silk pad), the butterfly would find another vertical surface to rest upon and harden its wings (such as a wall or fence).
A cocoon is a casing spun of silk by many moths and caterpillars,[16] and numerous other holometabolous insect larvae as a protective covering for the pupa.
Cocoons may be tough or soft, opaque or translucent, solid or meshlike, of various colors, or composed of multiple layers, depending on the type of insect larva producing it.
Some larvae attach small twigs, fecal pellets or pieces of vegetation to the outside of their cocoon in an attempt to disguise it from predators.
Some cocoons are constructed with built-in lines of weakness along which they will tear easily from inside, or with exit holes that only allow a one-way passage out; such features facilitate the escape of the adult insect after it emerges from the pupal skin.
Flies of the group Muscomorpha have puparia, as do members of the order Strepsiptera, and the Hemipteran family Aleyrodidae.