The longitudinal electron beam properties are of crucial importance for many types of frontier accelerators, from storage rings to free electron lasers and energy recovery linacs. For the online control of the machine and its stable operation, nondestructive shot by shot bunch length measurements are needed. Among the various instrumentations proposed and installed in accelerators worldwide, the ones based on the measurement of the coherent radiation power represent the simplest and the more robust tools for operational control. The major limitation of these systems is that they usually can provide only relative bunch length estimation. In this Letter we present a novel experimental methodology to self-calibrate a simple equipment based on diffraction radiation from a gap providing a measurement of the second order moment of the longitudinal distribution. We present the theoretical basis of the proposed approach and validate it through a detailed campaign of measurements.