Medicinal plants are considered as one of the most important sources of chemical compounds, so preparing a suitable culture media for medicinal plant growth is a critical factor. The present study is aimed to improve the caffeic acid derivatives and alkylamides percentages of Echinacea purpurea root extract in hydroponic culture media with different perlite particle size and NO3−/NH4+ ratios. Perlite particle size in the growing media was varied as very coarse perlite (more than 2 mm), coarse perlite (1.5–2 mm), medium perlite (1–1.5 mm), fine perlite (0.5–1 mm), and very fine perlite (less than 0.5 mm) in different ratios to peat moss (including pure perlite, 50:50 v/v, 30:70 v/v, and pure peat moss). Two NO3−/NH4+ ratios (90:10 and 70:30) were tested in each growing media. All phytochemical analyses were performed according to standard methods using high performance liquid chromatography (HPLC). It was found that the E. purpurea grown in the medium containing very fine-grade perlite with 50:50 v/v perlite to peat moss ratio had the maximum caffeic acid derivatives, including chicoric acid (17 mg g−1 DW), caftaric acid (6.3 mg g−1 DW), chlorogenic acid (0.93 mg g−1 DW), cynarin (0.84 mg g−1 DW), and echinacoside (0.73 mg g−1 DW), as well as, alkylamides (54.21%). The percentages of these phytochemical compounds increased by decreasing perlite particle size and increasing of NO3−/NH4+ ratio. The major alkylamide in the E. purpurea root extract was dodeca-2E, 4E, 8Z-10 (E/Z)-tetraenoic acid isobutylamide in all treatments, ranging from 31.12 to 54.21% of total dry weight. It can be concluded that optimizing hydroponic culture media and nutrient solution has significant effects on E. purpurea chemical compounds.