Wireless sensor network (WSN) is a basic component of internet and it plays an important role in many application areas, such as military surveillance, environmental monitoring and medical treatment. Node localization is one of the interesting issues in the field of WSN. Now, most of the existing node localization algorithms can be divided into two categories. One is range-based measurement and the other is range-free measurement. The localization algorithm of range-based measurement can achieve better location accuracy than the localization algorithm of range-free measurement. However, they are generally very energy consuming. Therefore, the range-free measurements are most widely used in practical applications. According to the application of localization algorithm in WSN by range-free measurements, an improved centroid localization algorithm based on iterative computation for wireless sensor network is proposed. In this algorithm, the position relationship of the closed area surrounded by the anchor nodes inside the unknown node's communication range and the unknown node is obtained by approximate point-in-triangulation test at first. Different position relationships determine different stopping criteria for iteration. Then, the centroid coordinates of the closed area surrounded by the anchor nodes inside the unknown node's communication range and the received signal strength (RSSI) between the centroid node and the unknown node are calculated. The anchor node with the weakest RSSI would be replaced by the centroid node. By this method, the closed area surrounded by the anchor nodes inside the unknown node's communication range is reduced. The location accuracy is increased by the cyclic iterative method. With the change of the anchor node ratio, the communication radius of the unknown node and the effect of RSSI error, the algorithm performance is investigated by using simulated data. The simulation results validate that although the improved centroid localization algorithm performance will be lost when the number of the anchor nodes inside the unknown node communication range decreases, the new approach can achieve good performance under the condition of few anchor nodes inside the unknown node communication range and this method is of strong robusticity against RSSI error disturbance.