When Do Caterpillars Go Into Cocoons?

Caterpillars enter cocoons when they have finished growing and are ready to transform into their adult form, a transition typically triggered by a combination of reaching a critical body size and receiving the right environmental signals like day length and temperature. The timing varies enormously across species, from a few weeks after hatching to many months, and the word “cocoon” itself only applies to certain moths rather than all caterpillars. Understanding when and why a caterpillar makes this shift involves a surprisingly rich interplay between the insect’s internal chemistry and the world around it.

Not Every Caterpillar Spins a Cocoon

Before talking about timing, it helps to clear up a common mix-up. A cocoon is a silk casing that a caterpillar spins around itself before transforming into a pupa. Moths are the primary cocoon-builders. Butterflies, by contrast, do not spin cocoons at all. When a butterfly caterpillar is ready to pupate, it sheds its larval skin to reveal a hardened outer shell called a chrysalis. The chrysalis is the pupa itself, not a structure built around the pupa. So if you find a monarch caterpillar hanging in a jade-green casing, that is a chrysalis, not a cocoon.

Even among moths, not every species bothers with a silk cocoon. Hawk moths, for instance, burrow into the soil and pupate underground with no silk wrapper at all. Some species in the family Hepialidae also pupate underground; the Australian grass caterpillar, for example, forms prepupae in July and pupates through July to September in subterranean tunnels.1Australian Journal of Zoology. A field study on the biology of the underground grass caterpillar, Oncopera Fasciculata Walker (Lepidoptera: Hepialidae), in South Australia Other moth caterpillars pupate inside rolled or folded leaves, secured with just a few silk strands rather than a full cocoon. The masked birch caterpillar, for instance, folds a leaf edge tightly using about five to ten thick silk strands, encasing the pupa in what amounts to a leaf envelope.2Journal of Insect Science. Immature Stages of the Masked Birch Caterpillar, Drepana arcuata (Lepidoptera: Drepanidae) With Comments on Feeding and Shelter Building The classic image of a silky white or brown cocoon dangling from a twig applies mainly to silk moths and their relatives.

How Day Length Sets the Calendar

The single most important environmental cue telling a caterpillar when to pupate is photoperiod, the ratio of daylight to darkness over a 24-hour cycle. Caterpillars do not check calendars, but they are remarkably sensitive to how many hours of light they experience each day. Shortening days in late summer and autumn signal that winter is coming, which in many species triggers a slowdown: the caterpillar may delay pupation or, once it does pupate, enter a dormant state called diapause inside the cocoon. Lengthening days in spring signal that it is safe to develop quickly and emerge as an adult.

Research on the speckled wood butterfly shows just how asymmetric this system is. Exposure to long days late in a caterpillar’s life, regardless of what it experienced earlier, was enough to produce continuous, non-dormant development and speed up the larval growth rate. But inducing diapause required prolonged exposure to short days.3PubMed Central. Watching the days go by: Asymmetric regulation of caterpillar development by changes in photoperiod In practical terms, this means a caterpillar that happens to encounter a stretch of long, warm days near the end of its feeding stage will rush toward pupation, while one exposed to dwindling daylight will take its time and hunker down.

Artificial light complicates things. A study on cabbage moths found that caterpillars raised under green or white nighttime light pupated and emerged far sooner than those raised in darkness. Moths that experienced green or white light as caterpillars emerged after roughly 73 days on average, while those raised in the dark took about 139 days, nearly twice as long. Red light produced an intermediate result of around 118 days.4PubMed Central. Artificial light at night causes diapause inhibition and sex-specific life history changes in a moth The light was essentially tricking the caterpillars into skipping their winter dormancy. This finding has real implications for moths living near streetlights or lit buildings, where the natural photoperiod signal gets scrambled.

Temperature and the Speed of Development

Temperature does not usually decide whether a caterpillar will pupate, but it has a big influence on when. Warmer conditions speed up the entire growth cycle, so caterpillars reach their final size sooner. A field experiment on monarch caterpillars found that each 1°C increase in temperature shaved about half a day off the time to pupation.5PubMed Central. Effects of in situ climate warming on monarch caterpillar (Danaus plexippus) development Half a day per degree may not sound dramatic, but across a season with several degrees of warming, it can shift the entire population’s timing by a week or more.

Seasonal patterns in the tropics illustrate temperature’s role from another angle. In central Brazil’s cerrado grasslands, caterpillars at the start of the dry season tend to have shorter pupal periods, cycling through more generations and producing a seasonal spike in caterpillar abundance. As the dry season drags on, pupal duration stretches out, and by the end of the wet season, some species enter full pupal diapause, waiting months inside their cocoons before emerging.6Revista de Biología Tropical. Caterpillar seasonality in a central Brazilian cerrado The seasonal rhythm of temperature and moisture essentially modulates how quickly the whole larval-to-pupal pipeline runs.

Food Supply and Body Size as a Gatekeeper

A caterpillar cannot spin a cocoon until it has eaten enough to reach a threshold body mass. The link between nutrition and pupation timing is direct and measurable. When large white butterfly caterpillars were experimentally deprived of food for increasing periods, two things happened: their resulting pupae were smaller, and they actually pupated faster, as if cutting their losses and moving to the next stage before starving.7PLOS ONE. Plant Quantity Affects Development and Survival of a Gregarious Insect Herbivore and Its Endoparasitoid Wasp This makes a certain biological sense. A caterpillar running out of food gains nothing by lingering as a larva; better to pupate small than die hungry.

The host plant a caterpillar feeds on also matters in subtler ways. In the cotton bollworm, different host plants led to different rates of pupal diapause, and the mechanism turned out to be about body size. Plants that supported larger pupae produced lower rates of diapause, while plants that yielded smaller pupae were associated with higher diapause rates. When researchers directly manipulated larval nutrition by withholding food for two days, they saw the same pattern: lighter pupae were more likely to enter diapause.8PubMed. Pupal diapause of Helicoverpa armigera (Hübner) (Lepidoptera: Noctuidae) mediated by larval host plants: pupal weight is important So a caterpillar feeding on a poor-quality plant may end up entering its cocoon at a smaller size and then staying dormant longer, while one on a rich food source may sail through pupation without pausing.

The Prepupal Window

The transition from active feeding caterpillar to cocoon-enclosed pupa does not happen in a single moment. There is a recognizable prepupal stage that you can observe if you know what to look for. A caterpillar approaching pupation often stops eating, empties its gut (sometimes producing a noticeable liquid discharge), and begins wandering in search of a suitable spot. Its color may change, becoming duller or shifting hue. Many species shrink slightly as they purge gut contents.

The masked birch caterpillar, for example, spends two to three days as a fifth-instar larva feeding before entering a prepupal state, then continues feeding lightly for another day or two before folding a leaf into its pupal shelter. Once the leaf is fully folded, the actual pupa forms over the next two to three days.2Journal of Insect Science. Immature Stages of the Masked Birch Caterpillar, Drepana arcuata (Lepidoptera: Drepanidae) With Comments on Feeding and Shelter Building This window of restless wandering and shelter-building is when most people first notice something is happening, especially if a caterpillar they have been watching suddenly stops munching leaves and starts roaming the container or branch.

Hormonally, this phase is governed by a drop in juvenile hormone and a surge in a steroid hormone called ecdysone, which triggers the molt into the pupal form. In the Mediterranean flour moth, researchers found that cocoon spinning itself has two distinct phases: constructing the outer envelope and then spinning the inner lining. The outer phase can be modified by the caterpillar’s physical surroundings, such as the texture or shape of the space it is in, while the inner phase runs on a more rigid hormonal program tied to the onset of pupation.9Journal of Insect Physiology. Cocoon spinning behaviour in Ephestia kuehniella; Correlation with endocrine events So even the act of building the cocoon is partly flexible and partly hard-wired.

Overwintering Inside the Cocoon

Many moth species spend the winter as pupae inside their cocoons, a strategy that lets them ride out months of cold, food scarcity, and short days in a state of near-suspended animation. Diapause is not simply being cold and sluggish. It is a physiologically distinct state where metabolism drops to a fraction of its normal rate and development essentially pauses until the right combination of warming temperatures and lengthening days flips the switch back on.

This period inside the cocoon can be dangerous. A study on two species of slug caterpillar moths placed cocoons in the field under saplings and monitored them through winter. Predation rates were substantial: roughly 29% of saddleback caterpillar cocoons and 22% of spiny oak-slug caterpillar cocoons were attacked by predators. Larger cocoons fared better on both counts, being less likely to be eaten and more likely to produce a successfully emerged moth the following year.10Environmental Entomology. Winter predation of diapausing cocoons of slug caterpillars (Lepidoptera: Limacodidae) Birds, rodents, and parasitic wasps all target overwintering cocoons, so the cocoon is not just a development chamber but a survival capsule whose construction quality and size have real consequences.

The decision to enter diapause or develop straight through is typically made during the larval stage, well before the cocoon is spun. As the photoperiod research described earlier shows, caterpillars are reading daylight signals throughout their growth and committing to one developmental path or the other. By the time the cocoon is finished, the pupa inside has already been programmed for either a quick transformation or a long wait.

Climate Change Is Shifting the Schedule

Because temperature and day length are the main timekeepers for caterpillar development, climate change is reshuffling the timing of pupation across many species. Warmer springs mean caterpillars grow faster and reach their cocoon stage earlier. A 20-year study on caterpillar populations in Europe found that the annual peak in caterpillar biomass has shifted earlier, tracking rising spring temperatures. But the birds that rely on caterpillars to feed their chicks have not shifted their breeding dates at the same pace, creating a mismatch between when chicks need food and when caterpillars are most abundant.11PubMed. Shifts in caterpillar biomass phenology due to climate change and its impact on the breeding biology of an insectivorous bird The caterpillars are not doing anything wrong from their own perspective; they are simply responding to the temperature cues they have always used. But when those cues shift faster than the broader food web can track, the downstream effects ripple outward.

Artificial light at night adds another layer of disruption. As noted in the light-exposure study on cabbage moths, nighttime illumination can effectively prevent diapause, pushing caterpillars to pupate and emerge on schedules that would normally only occur in summer. For species living in urban or suburban areas near constant light sources, this could mean emerging in the wrong season, when food plants or mates are scarce.

How Moths Break Out of Their Own Cocoons

Getting into a cocoon is one thing. Getting out is a problem that evolution had to solve separately, and the solution is elegant. Silk cocoons, especially thick ones like those of commercial silkworms, are tough enough that a freshly emerged moth cannot simply chew or push its way through. Instead, silk moths produce a specialized enzyme called cocoonase, secreted from glands in the head. The moth releases this protein-dissolving enzyme onto the inner surface of the cocoon, softening the silk enough to push through.

The classic description of this mechanism comes from the Chinese oak silkmoth, where the moth secretes a nearly pure protease from its mouthparts, then dissolves and activates it with a solvent produced by a second set of glands. Together, these chemicals create a wet, weakened escape hatch at one end of the cocoon.12PubMed. Enzymatic Mechanism for the Escape of Certain Moths from Their Cocoons Escape is normally accomplished through the front end, though in rare cases moths can struggle out through the back with difficulty.13Insect Biochemistry. Cocoonases of silkworm moths: Catalytic properties and biological function

How critical is cocoonase? Researchers working with domesticated silkworms knocked out the cocoonase gene entirely. The mutant moths developed normally, spun normal cocoons, and completed metamorphosis without any problems. But not a single one could escape. Every moth that lacked cocoonase remained trapped in its cocoon, no matter how thin the silk wall was. When researchers split the cocoons open by hand, perfectly formed adult moths were sitting inside. Months later, unrescued cocoons remained sealed, the moths dead inside without decay.14PLoS Genetics. Cocoonase is indispensable for Lepidoptera insects breaking the sealed cocoon The experiment was a stark demonstration that the cocoon is not just a protective barrier against the outside world but an engineering challenge the moth must chemically defeat from within.

Why Silk Moths Build Cocoons but Hawk Moths Dig Holes

The diversity of pupation strategies across moths raises a natural question: why do some lineages spin elaborate silk cocoons while close relatives skip silk entirely? A genomic study comparing 11 species across the silk moth superfamily found that the answer involves both shared ancestry and independent reinvention. Silk-producing lineages like the giant silk moths (Saturniidae) show distinct patterns of gene expression in their silk glands, with many genes specialized for amino acid metabolism and silk protein production. Their close relatives the hawk moths (Sphingidae), which do not spin cocoons, lack this specialized gene activity.15The Innovation Life. Divergent and convergent evolution underlie the cocoon-spinning diversity

Interestingly, the silk moths and the domesticated silkworm (family Bombycidae) arrived at cocoon-spinning independently, through convergent evolution. Different sets of genes came under selection in each lineage, yet the end result, a silk cocoon, looks functionally similar. This pattern suggests that the ecological pressures favoring cocoons, such as protection from predators, temperature buffering, and humidity regulation, are strong enough that multiple moth lineages have evolved the same solution from different genetic starting points.

Practical Timing If You Are Raising Caterpillars

If you are keeping caterpillars at home or in a classroom, the most common question is simply how to know when pupation is imminent. The behavioral signs are fairly universal. A caterpillar that has been eating steadily will slow down, stop feeding, and may produce a watery discharge as it empties its gut. Many species change color, often becoming darker or more translucent. The caterpillar will then begin wandering restlessly, looking for a suitable spot. For moth species, this is when silk-spinning starts.

Temperature matters in captivity just as it does in the wild. Keeping caterpillars slightly warmer than ambient outdoor temperature will speed development, while cooler conditions slow it down. If you are raising a species that naturally overwinters as a pupa, you will need to provide a cold period of several weeks to months (typically around 4°C in a refrigerator) to break diapause and allow the adult to emerge in spring. Skipping this chill period often means the moth or butterfly never emerges at all.

In commercial silkworm farming, timing the transfer of mature larvae to spinning frames is a practical concern. Research on domesticated silkworms found that shifting the transfer by 12 hours earlier or later than the traditional timing had no measurable effect on the quality or quantity of silk produced.16Progress in Biological Sciences. Effect of 12-hours delay and anticipation from traditional practice in silkworm mounting to spinning frames on economic traits of Bombyx mori (Lepidoptera: Bombycidae) cocoons This gives sericulture farmers some scheduling flexibility, but it also illustrates a broader point: once a caterpillar has committed to pupation, the process is robust and hard to derail by minor timing changes. The machinery is already in motion.