Cordycepin is a characteristic bioactive compound of Cordyceps militaris with various beneficial effects. Cordyceps grows on both grains and insects, and the content of cordycepin varies depending on the cultivation conditions. In this study, the effect of culture conditions on the cordycepin content was analyzed and the extraction conditions were optimized. Analysis of cordycepin content in Pupae-Cordyceps found that it was highly affected by temperature in culture conditions. In the case of mycelium, it grows well at 20 and 25 ℃, but not at 30 ℃. However, the content of cordycepin was highest at 30°C and less at 20 ℃. The fruiting body also showed a similar tendency: growth was 20 ℃ > 25 ℃ > 30 ℃, but the cordycepin content was 30 ℃ > 25 ℃ > 20 ℃. The content of cordycepin decreased after the fruiting bodies were produced. Next, extraction conditions such as solvent and time were optimized for maximum cordycepin content using response surface methodology (RSM). There was a large difference in the content of cordycepin according to the content of ethanol and the extraction temperature. Through RSM, it was confirmed that the optimum condition for extraction of cordycepin was 48.9 ℃ using 49.0% ethanol, and 160.9 mg/g extract could be obtained under this condition. In conclusion, this study suggested the optimized conditions for the cultivation and extraction of Pupae-Cordyceps for maximizing the content of cordycepin, and this may be applied to the discovery of materials using cordycepin.