This research is concerned with the removal of ammonia nitrogen and phosphorus in foodwaste by crystallization. Reductions have been achieved by struvite formation after the addition of magnesium ions (Mg2+). Magnesium ions used in this study were from magnesium salts of MgCl2. The results of our analysis using scanning electron microscopy and energy dispersive X-ray analysis showed that the amount of struvite in precipitated sludge grew enough to be seen with the naked eye (600-700 microm). EDX analysis also showed that the main components of the struvite were magnesium and phosphorus. NH3-N removal efficiency using MgCl2 was 67% while PO4-P removal efficiency was 73%. It was confirmed that nitrogen and phosphorus could be stabilized and removal simultaneously through anaerobic digestion by Mg, NH3 and PO4-P, which were necessary for struvite formation.