Riemann surfaces are among the simplest and most basic geometric objects. They appear as key players in many branches of physics, mathematics, and other sciences. Despite their widespread significance, how to compute distances between pairs of points on compact Riemann surfaces is surprisingly unknown, unless the surface is a sphere or a torus. This is because on higher-genus surfaces, the distance formula involves an infimum over infinitely many terms, so it cannot be evaluated in practice. Here we derive a computable distance formula for a broad class of Riemann surfaces. The formula reduces the infimum to a minimum over an explicit set consisting of finitely many terms. We also develop a distance computation algorithm, which cannot be expressed as a formula, but which is more computationally efficient on surfaces with high genuses. We illustrate both the formula and the algorithm in application to generalized Bolza surfaces, which are a particular class of highly symmetric compact Riemann surfaces of any genus greater than 1.