In order to remove the vast information redundancy in dense Wireless Sensor Networks (WSN), a distributed source coding algorithm for clustering WSN is proposed. The algorithm uses the correlation among the sources to define the coding sequence and their reference source with the side information as the initial reference source and each source codes its data with respect to its reference source, and the receiver decodes the data according to the coding sequence and reference source. In addition, a decoding algorithm with low complexity for modulus coding is given. The analysis and simulation results show that the proposed algorithm applied to clustering routing protocol can effectively reduce the number of bits to be sent, and thereby decrease the energy consumption of network and prolong the network lifetime.