The silk is actually hardened silkworm saliva. It comes out of the mouth, not out of the rear end like a spider. When the silkworm ate great quantities of mulberry leaves, they were digested and nutrients were sent into the bloodstream. The silk glands absorbed these nutrients. The larva has a small spinneret on its lip, through which the silk emerges. The single strand of silk that forms the cocoon is about one mile long!
The silkworm moves its head in figure 8 patterns as it spins the cocoon. When the cocoon is partially made, you can see the head moving around inside if you hold it up to the light as shown at the left.
Finished cocoons are opaque and about two inches long. Silkworm farmers place cardboard grids near the silkworms. The silkworms spin their cocoons inside these frames.
To continue to the next stage of development, click on Becoming a moth.