Caterpillars have voracious appetites, eating constantly while awake. These herbivorous larvae feed on leaves from a host plant, to which they attach themselves. Each species of caterpillar has a favored host plant and will eat only the leaves of that plant. If they are deprived of food, they will quickly die; they are also vulnerable to toxins in the material they eat.
Water is an essential material to sustain life, but a caterpillar does not need to drink water directly from a water source. Instead, the caterpillar consumes all the water it needs from the leaves and plant material that it eats. Water is an important component of these food sources.
Caterpillars do not need direct sunlight to survive. Caterpillars can live in the shade of trees or in other areas out of direct sunlight. Caterpillars can also live indoors; you can keep a caterpillar alive in a ventilated jar, provided it has the right leaves to eat.
If its food source disappears, a caterpillar will move away and begin the search for more food. Caterpillars avoid water, which will drown them if they cannot escape from it. A good place to keep a caterpillar is a terrarium so you can observe its molting and development into a butterfly. You need to clean the enclosure regularly and prevent any buildup of condensation or heavy moisture. A twig or small stick should also be provided; the caterpillar will attach itself to the stick before it molts.