Irradiation of materials with neutrons and detection of the prompt gamma ray due to (n,?) reaction, is the basis of prompt gamma neutron activation analysis (PGNAA). PGNAA is a stable nuclear method that has important applications in detection of explosive materials, identify various elements in body and….In this project, using the MCNPX simulation code, a PGNAA system is designed for identification of nitrogen in materials. The PGNAA system consists of Am-Be neutron source, NaI gamma ray detector, a sample (melamine powder) containing nitrogen, moderator and gamma shield. Due to the high cross section of thermal neutron interactions with elements in (n,?) reaction, a moderator is designed with suitable material and thickness to put around the sample containing nitrogen. Geometry of the moderator should be such that to increase thermal neutron flux in the sample. For this purpose, the moderator covers the sample from 5 faces and the sixth face is in front of the gamma ray detector. Using the code, simulation of PGNAA system is done for different thicknesses of three moderator light water, heavy water and polyethylene to achieve the maximum neutron flux in the sample or in other words, to maximize the stored gamma ray in the detector. Optimum thicknesses for three moderators were determined with optimizing the abundance of prompt 10.8 MeV nitrogen gamma ray in detector. The optimum thicknesses were found to be 6 cm, 12 cm and 6 cm for light water, heavy water and polyethylene respectively. After obtaining the simulation results, the PGNAA system was also set up experimentally for light water moderators of 6 and 9 cm thicknesses. The experimental results obtained were in good agreements with simulation results and we can therefore conclude that the designed PGNAA system has optimum conditions for detection of nitrogen in various samples. Keywords PGNAA, Neutron source, Gamma ray detector, Moderator