Local binary patterns (LBPs) are one of the features which have been used for texture classification. In this paper, a method based on using these features is proposed for fabric defect detection. In the training stage, at first step, LBP operator is applied to an image of defect free fabric, pixel by pixel, and the reference feature vector is computed. Then this image is divided into windows and LBP operator is applied to each of these windows. Based on comparison with the reference feature vector, a suitable threshold for defect free windows is found. In the detection stage, a test image is divided into windows and using the threshold, defective windows can be detected. The proposed method is multiresolution and gray scale invariant and can be used for defect detection in patterned and unpatterned fabrics. Because of its simplicity, online implementation is possible as well.