Silkworm pupae, a rich source of protein and micronutrients, are increasingly consumed. Artificial diets, enabling year-round silkworm rearing, are susceptible to spoilage. This study evaluated ethylparaben (EP) and medium-chain fatty acids (MCFA) as preservatives in silkworm artificial diets. Both effectively inhibited bacterial growth without negatively impacting silkworm production or gut microbiota homeostasis. However, EP upregulated detoxification and immune response genes. MCFA emerged as a safer, natural preservative option for improving silkworm artificial diet formulation.