Objective To investigate the feasibility of nitrogen and phosphorus recovery from swine waste biogas digester effluent and the effects of pH and NH4^+: Mg2^+: PO4^3- molar ratio on its precipitation. Methods Precipitation experiments with swine waste biogas digester effluent were conducted at pH 7.5, 8.0, 8.5, and 9.0 together with NH4^+: Mg^2+: PO4^3- molar ratios 1: 0.2: 0.08, 1: 1: 1, and 1: 1.5: 1.5. Chemical and X-ray diffraction (XRD) analysis were done to determine the composition of the precipitate. Results The highest removal and recovery of NH4^+ and PO4^3- were achieved at pH 9.0 in each experiment. The elevation of pH to 9.0 alone could decrease the initial PO4^3- concentration from 42 mg L^-1 to 4.7 mg L-1 and 89.2% PO4^3- recovery was achieved. The pH-molar ratio combination 9.0-1: 1.5: 1.5 effected 76.5% NH4^+ and 68.5% PO4^3- recovery. The molar ratio of 1: 1: 1 together with pH elevation to 9.0 was determined to be the optimum combination for both NH4+ and PO4^3- removal as it recovered over 70% and 97% of the initial NH4^+ and PO4^3-, respectively. Conclusions Nitrogen and phosphorus can be recovered from biogas digester effluent as struvite.