The swallowtail butterfly, Papilio xuthus, changes its larval body pattern dramatically during the fourth ecdysis. Cuticular pigmentation occurs with precise timing just before ecdysis. We previously found that the cuticular pigmentation was regulated by three melanin synthesis genes, tyrosine hydroxylase (TH), dopa decarboxylase (DDC), and ebony. We discovered that yellow is strongly expressed in the presumptive black markings earlier than TH and DDC. Because the ecdysis is triggered by 20-hydroxyecdysone (20E), the effects of 20E on the pigmentation and expression of the melanin synthesis genes were examined. Here, we established a method for the topical application of 20E to molting specimens, so that 20E has only a partial effect, resulting in successful ecdysis. When we applied 20E during the mid-phase of the molting period, when the 20E titer is declining, cuticular pigmentation was completely inhibited. The cessation of hormonal treatments caused delayed pigmentation. yellow expression was promoted by a high titer of 20E, whereas the expression of TH, DDC, and ebony was suppressed, suggesting that a decline in the 20E concentration is necessary for the induction of the expression of the latter three genes. These results indicate that cuticular pigmentation is controlled by the exposure to 20E and its removal.