This work describes an algorithm for automatic counting of alpha tracks in scanned images of electrochemically etched CDs and DVDs. It is demonstrated that the algorithm copes with the specific problems encountered in retrospective 222 Rn measurements with CDs and DVDs; it reliably separates overlapping tracks and ignores artifacts in the image. The algorithm is validated by comparison to manual counting and a very good correlation is found. The measurement range of 222 Rn concentrations in dwellings and soil gas is estimated. It is shown that the wide span of track densities that can be covered by the algorithm combined with the specific advantages of the compact disc method can provide reliable measurements in the whole range of 222 Rn concentrations of practical interest. For retrospective measurements of 222 Rn in dwellings the estimated range is from 10 Bq m 3 to 100 kBq m 3 for five years exposure time. For 222 Rn in soil gas the estimated range is from 1 kBq m 3 to 10 MBq m 3 for ten days exposure time.