Rail fasteners are the key components of railway tracks, and regular inspection of them is conducive to the safe operation of railway lines. In order to establish a real-time and efficient rail fasteners tightness safety detection system, a self-powered vibration sensor based on electrospinning nanofibers with high output performance TENG is proposed for daily safety inspection of rail fasteners. The power generation performance of the vibration sensor is characterized with the open-circuit voltage of 185 V, the short-circuit current of 5.68 μA cm−2, and the power density of 4.28 W m−2 under matching load. In addition, it also has excellent working stability, good environmental adaptability and fast response time (40 ms). Therefore, the vibration sensor can not only effectively collect rail vibration energy to achieve energy self-supply, but also accurately identify the tightness of rail fasteners according to the vibration characteristics, so as to ensure the safe operation of railway lines. The manufacturing process of the vibration sensor is convenient, economical and practical, and it is hoped to provide a meaningful detection method for maintaining the safety of railway lines.