A laboratory treatment system was designed to study the fate of nitrogen during aerobic treatment of pig slurry. Different aeration strategies, and more particularly the influence of residence time and aeration level, were manipulated. A series of six experiments was carried out to determine the nitrogen mass balance, including measurement of the gaseous nitrogen forms particularly ammonia and nitrous oxide. Further nitrogen transformations were examined during the subsequent anaerobic storage of aerated pig slurry at 7, 21 and 60 days. Aeration level and carbon content of raw slurry were identified as the main factors influencing nitrogen transformation during treatment. A high aeration level (2–4 mg O2/l) and/or low carbon content (biological oxygen demand of the raw slurry approximately 2 g/kg) resulted in nitrite accumulation (up to 33% of the total nitrogen content of the raw slurry) while a low level of aeration (redox potential=0 mVAg/AgCl) and high carbon content (biological oxygen demand of the raw slurry approximately 16 g/kg) led to simultaneous nitrification and denitrification which removed 66% of the total nitrogen in the raw slurry. Nitrous oxide emissions were observed in all treatments and represent up to 30% of the total nitrogen content of the raw slurry. Both nitrification and denitrification appear to be sources of nitrous oxide during the treatment. Further nitrous oxide emissions were recorded during subsequent storage, especially when the biological oxygen demand to NO−x-N ratio was lower than 1·3. However, during closed storage experiments, the nitrous oxide emitted was dissolved into the slurry and finally reduced to di-nitrogen after 60 days of storage.