In this study, a foam fractionation technique was developed for the separation and enrichment of the trace m-phenylenediamine (MPD) and o-phenylenediamine (OPD) in solution. Firstly, a self-designed foam fractionation device was assembled and built, followed by a comprehensive characterization on gas types, foam fractionation column parameters, and porous sieve plate material used in the apparatus. Subsequently, the most crucial parameters for the separation and enrichment, such as surfactant species, solution pH, electrolyte categories, and gas flow rate, were identified and optimized. The mechanisms of key processes during foam fractionation under the influence of these parameters were thoroughly discussed. Other influencing factors, such as surfactant concentration, foam collection time, and solution volume in the fractionation column, were optimized using response surface methodology (RSM). Under these optimal conditions, maximal enrichment ratios of 138.2 and 85.5 were achieved for MPD and OPD, respectively. Finally, foam fractionation coupled with high-performance liquid chromatography (HPLC) was employed to detect MPD and OPD in the solution. The results demonstrated limits of detection (LOD) of 1.5 × 10−2 μg/L and 1.5 μg/L for MPD and OPD, with relative standard deviation (RSD) values of 4.1 % and 3.9 %. When testing various actual samples, the recoveries were in the range from 92.0 % or greater in all cases. The method exhibited advantages of high sensitivity, precision, and accuracy, attributed to the high enrichment efficiency of foam fractionation. In conclusion, the foam fractionation method established in this study offers simplicity in apparatus, operational convenience, environmental friendliness (minimized use of organic solvents), and high enrichment efficiency. It proves valuable for the quantitative analysis of trace amounts of MPD and OPD in solution, presenting a novel approach for the detection of trace organic compounds in solutions.