Purpose -Fabric defect detection plays an important role in textile quality control. The purpose of this paper is to propose a fabric defect detection algorithm via context-based local texture saliency analysis. Design/methodology/approach -In the proposed algorithm, a target image is first divided into blocks, then the Local Binary Pattern (LBP) technique is used to extract the texture features of blocks. Second, for a given image block, several other blocks are randomly chosen for calculating the LBP contrast between a given block and the randomly chosen blocks. Based on the obtained contrast information, a saliency map is produced. Finally, saliency map is segmented by using an optimal threshold, which is obtained by an iterative approach. Findings -The experimental results show that the proposed algorithm, integrating local texture features and global image texture information, can detect texture defects effectively. Originality/value -In this paper, a novel fabric defect detection algorithm via context-based local texture saliency analysis is proposed.