Considering the massive original data together with limited data storing space and processing speed, it necessary to research fast, efficient and diagnostically lossless compression algorithm in magnetic flux leakage (MFL) detection. This paper analyzes the special requirements of data compression in MFL detection, and proposes a segmented self-adaptive compression algorithm considering the feature of inspection data. The MFL data is divided into different segments, and different compression methods are applied to them. The section length together with compression threshold could adjust the compression ratio and distortion factor. The result of experiment, based on MFL detection data of pipelines with standard defects, shows that the algorithm gets high compression ratio while keeping low distortion factor. The algorithm could meet requirements on efficiency, quality and complexity to compress massive MFL data fast and efficiently.