Why is molting necessary for the growth of a butterfly?

Molting is necessary for the butterfly larvae, called a caterpillar, as it repeatedly outgrows its skin. Their skin doesn't grow to accommodate them, and therefore needs to be periodically shed to reveal new skin underneath. After about four sheds, the caterpillar will turn into a pupa and then emerge as an adult butterfly.