Inside the cocoon, the larva changes to a pupa and eventually transforms into an adult insect. Among the insects that spend part of their lives in cocoons are wasps, bees, caddis flies, moths, and some ants. Many spiders spin silk cocoons around masses of their eggs and sometimes around their prey. The chief substance of most cocoons is silk. But the larva often incorporates other substances, including soil, sand grains, plant materials, and hair or waste from its own body.
Some cocoons contain very little silk at all.
But many species pass the pupal stage in soil or in parts of plants without forming a cocoon. A few butterfly caterpillars make flimsy cocoons, but most pupate as a hard-shelled chrysalis. Perhaps the best-known cocoon is that of the caterpillar of the Bombyx mori moth, which supplies most of the world's commercial silk. Most moth caterpillars build their cocoons in protected places in fallen logs, openings in tree bark, or among debris and fallen leaves. Cocoons of some large species, such as Cecropia, Promethea, and Polyphemus moths, are fastened to twigs of trees and can easily be found during winter.