It is not possible to determine the mass of elementary particles by the usual methods that are used to mass of large objects. Special methods are used to measure the mass of extremely small particles like protons, neutrons and electrons.
The mass of charged particles can be measured by using a magnetic field where the intensity of the magnetic field is known very accurately. Charged particles moving at a velocity perpendicular to the magnetic field follow a circular path that has a radius dependent on the ratio of the particle's charge to its mass.
A neutron is an uncharged particle and this does not allow the use of methods suitable for charged particles to be used here. The mass of a neutron is determined using a more complex method. This involves the use of protons and deuterons. As protons and deuterons are charged particles, their mass is estimated using a magnetic field.
Deuterons are created by colliding protons and neutrons and this gives off a photon with a known energy. The mass-energy equation requires that the mass of the neutron (N) is equal to the mass of the deuteron (D) minus the mass of the proton (P) plus the energy of the gamma ray released (E). As P, D and E are known the mass of the neutron is: P - D + E = 939.565346 MeV
This is how the mass of a neutron is determined.