A horizontal cylindrical tank is a common storage device for petroleum products, and its capacity table is an important basis for calculating the volume of liquid poured into and out of the tank. In this study, a method for measuring the capacity of horizontal cylindrical tanks is proposed, focusing on the problems of large workload and time consumption of existing measurement methods. The method is based on the Monte-Carlo algorithm. The capacity table is calculated by arranging the sensor points on the inner wall of the tank, and then counting the number of sample points that fall in the horizontal cylindrical tank according to the coordinates of the sensor point, the distance from the sensor point to the origin, and other parameters. It was found, that the relationship between the relative error of the measured result and the height of the liquid level conforms to the exponential function. Based on this relationship, the error compensation algorithm is established, which can help to reduce the absolute error and relative error of the measurement result. [ABSTRACT FROM AUTHOR]