The accuracy and precision of several algorithms, including newly developed, for calculating the fractal dimension from scanning probe microscopy images of material surfaces are investigated. The algorithms are based on the area-perimeter method, a variance method or versions of the structure function method. The latter two methods show good correspondence to computer simulated images, with known fractal dimensions, and have successfully been applied also on real images. The results show that these two methods give reliable fractal dimensions and are well suited to describe surface roughness quantitatively.