Lactic acid bacteria (LAB) are known to possess potent antifungal activity; however, the factors that affect this activity remain poorly investigated. In this study, we explored the influence of physicochemical and nutritional factors on the antifungal activity of five LAB strains namely Lactiplantibacillus pentosus 22B, Leuconostoc mesenteroides 8C2, Lactiplantibacillus plantarum 21B, Enterococcus faecium LC2V5 and Enterococcus faecium LC2P8. These factors included incubation period, medium initial pH, incubation temperature, long-term storage and carbon source. Results showed that these factors significantly influenced the antifungal activity of the studied LAB strains (p < 0.0001). The optimal conditions yielding the most potent inhibition (21 ± 0.4 mm to 19 ± 0.4 mm) were identified. Specifically, maximum activity was achieved after a 48-h incubation (late stationary phase), at 25–30 °C, an initial pH of 3–4, and with sucrose, galactose, or mannose as the carbon source, depending on the strain. Moreover, long-term storage at − 80 °C led to complete loss of activity in two strains (8C2 and LC2P8), while the other three remained stable. Furthermore, HPLC and GC–MS analyses were used to identify the antifungal compounds produced by these three stable strains. The results revealed the presence of various organic acids (lactic, acetic, formic, malic, and fumaric acids) and fatty acids, such as 9-octadecenoic acid, 11-dodecenoic acid, 10-hydroxy. Scanning electron microscopy confirmed that these compounds caused significant structural damage to fungal mycelia, supporting their demonstrated fungicidal effects. This study improves our understanding of the key factors and mechanisms underlying LAB antifungal activity, contributing to the optimization of their use as natural antifungal agents.