Declining earth resources, rising ore cost and pollution call for better recycling of wastewater in the context of the circular economy. In particular, urine is a potential huge source of phosphorus (P) and potassium (K) agricultural nutrients, yet the efficiency of actual methods for P and K recovery are limited. Here we designed a electrochemical crystallization system using sacrificial magnesium anodes to recover P and K in the form of K-struvite (MgKPO4·6H2O) from simulated urine at low (P/K=0.25) and high (P/K=0.6) phosphate levels, respectively. Results show optimal recoveries of 88.5% for P and 35.4% for K in the form of rod-shaped K-struvite at 3.5 mA/cm2, yet higher current density reduced recovery due to side reactions and pH increase. Adding phosphate to urine increased K recovery to 35.4% versus 15.0% without phosphate. Adding prefabricated struvite crystals at 1.6 g/L into urine enhanced the recovery of K by 14.7% and of P by 23.7% compared to the control group. Overall, our findings show that electrochemical crystallization is promising for the recovery of K-struvite fertilizers.