1. In insects, cuticular melanization and immune function are strongly dependent on the quantity of dietary protein ingested. However, relatively little is known about the role played by the quality of nitrogenous resources in determining phenotypic variation in the degree of melanization and correlated immunological functions. We explored this issue in a generalist-feeding caterpillar, Spodoptera littoralis, by providing larvae with one of two semi-artificial diets differing in their quality of protein supplement (high-quality casein vs. low-quality zein). 2. Larvae given a high-quality protein diet had higher survival and faster growth rates than larvae on the low-quality protein diet; they also had more heavily melanized cuticles. Two components of constitutive immunity were assayed: lysozyme-like antibacterial activity and phenoloxidase (PO) activity. PO activity was not affected by diet quality, but antibacterial activity was higher for insects on the high-quality diet, providing a potential physiological mechanism for observed survival differences between the two dietary treatments. 3. Analysis of nitrogen conversion efficiency using chemically defined diets indicated that protein-quality had little effect on ingestion rates (i.e. nitrogen acquisition), but that post-ingestive utilization of nitrogen was reduced for larvae on the low-quality protein diet. This result implies that protein-quality had a significant influence on the nitrogen pool potentially available for investment in melanin production and immune function. 4. A split-plot, full-sib family breeding experiment was used to dissect the genetic control of cuticular melanization from the effects induced by dietary treatment. Estimates of broad-sense heritability indicated that the expression of melanization had a significant genetic basis, but there was little evidence for a genotype × environment interaction. 5. These results suggest that nutrition is a key factor that influences insect melanization and mediates its coupling with important physiological functions linked to survival.