In situsynchrotron powder X-ray diffraction (PXRD) is used to study the formation of LiFePO 4nanoparticles during hydrothermal synthesis from LiOH, H 3PO 4, and two different iron precursors, FeSO 4and (NH 4) 2Fe(SO 4) 2. Furthermore, the synthesis of Li(Fe 1− x Mn x )PO 4( x= 0.25, 0.50 and 0.75) from LiOH, H 3PO 4and FeSO 4/MnSO 4is studied. The reactions involve an unknown intermediate phase, which is not the previously observed intermediate NH 4FePO 4·H 2O. The intermediate phase quickly transforms into LiFePO 4and Li(Fe 1− x Mn x )PO 4even at rather low temperatures. The presence of ammonium enhances the formation of LiFePO 4, and it also leads to a significant reduction in the concentration of Li–Fe antisite defects. The in situPXRD technique allows one to follow the influence of time, temperature and manganese doping on the antisite defect concentration, and it is shown that even under supercritical conditions a reaction time of several minutes is required to suppress the defects. This makes flow synthesis of defect-free LiFePO 4and Li(Fe 1− x Mn x )PO 4nanoparticles challenging.