The X(3872) is the first and the most interesting one amongst the abundant XYZ states. Its mass coincides exactly with the D0Dˉ∗0 threshold with an uncertainty of 180 keV. Precise knowledge of its mass is crucial to understand the X(3872). However, whether it is above or below the D0Dˉ∗0 threshold is still unknown. We propose a completely new method to measure the X(3872) mass precisely by measuring the X(3872)γ line shape between 4010 and 4020 MeV, which is strongly sensitive to the X(3872) mass relative to the D0Dˉ∗0 threshold due to a triangle singularity. This method can be applied to experiments which produce copious D∗0Dˉ∗0 pairs, such as electron-positron, proton-antiproton and other experiments, and may lead to much more precise knowledge about the X(3872) mass.