Measurement of x-ray emission is an important parameter to investigate runaway behavior of fast electrons produced in nanosecond-pulse gas discharge. An online detection system of x rays is described in this paper, and the system consists of an x-ray detector with NaI (Tl) scintillator and photomultiplier tube, and an integrated multichannel analyzer. The system is responsible for detecting x-ray emission signal, processing the detected signals, and scaling the energy distribution. The calibration results show that every channel of the detection system represents a given x-ray energy and various x rays can be divided into different energy ranges between 10 and 130 keV. For a repetitive nanosecond-pulse breakdown between highly nonuniform gaps in open air, an energy distribution is obtained using the online detection system. It shows that the x-ray emission is a continuous spectrum and the x rays of above 60 keV dominate in the detected energy distribution.