Background Subtraction (BGS) is one of the main techniques used for moving object detection which further utilized in video analysis, especially in video surveillance systems. Practically, acquiring a robust background (reference) image is a real challenge due to the dynamic change in the scene. Hence, a key point to BGS is background modeling, in which a model is built and repeatedly used to reconstruct the background image.From N frames the proposed method store N pixels at location(x,y) in a buffer, then it classify pixel intensity values at that buffer using a proposed online clustering model based on the idea of relative run length, the cluster center with the highest frequency will be adopted as the background pixel value at location (x,y). For background updating, two approaches has been proposed to repeatedly update background image.The experiment results show that the average Precision, Recall and F-measure for the proposed method was 0.89, 0.96 and 0.93 respectively. While the average time in seconds required to construct background pixel from a buffer of size 50, 100 and 150 pixel was 0.0022813 sec , 0.0510166 sec and 0.12240419 sec respectively.