A way has been developed to measure the unit-cell parameters of a single crystal just from an energy scan with X-rays, even when the exact energy of the X-rays is not well defined due to an error in the pitch angle of the monochromator. The precision of this measurement reaches da/a ∼ 1 × 10−5. The method is based on the analysis of diffraction losses of the beam, transmitted through a single crystal (the so-called `glitch effect'). This method can be easily applied to any transmissive X-ray optical element made of single crystals (for example, X-ray lenses). The only requirements are the possibility to change the energy of the generated X-ray beam and some intensity monitor to measure the transmitted intensity. The method is agnostic to the error in the monochromator tuning and it can even be used for determination of the absolute pitch (or 2θ) angle of the monochromator. Applying the same method to a crystal with well known lattice parameters allows determination of the exact cell parameters of the monochromator at any energy.