Main sequence fitting (or cluster fitting) is the determination of the distance to a stellar cluster making use of a H-R diagram (HRD) of the cluster. The goal is stellar distance determination through determining stars' absolute magnitudes, based upon their spectral types. The method is similar to spectroscopic parallax, but by applying it to a number of stars, accuracy is better since random errors can be averaged, outliers can be noted and handled appropriately, and specific characteristics of the cluster can be considered. Stellar distance determination is a challenge and this method yields a single estimate appropriate for all the cluster's stars.
The cluster is presumed to have been formed by a single molecular cloud, formed around the same time, with the same metallicity, and remaining in the region of their formation. As a result, the HRD is tighter than that of more heterogeneous sets of stars. Once reasonable estimates of distance and absolute magnitude are determined, they provide observation targets for study of the stars and calibration of other methods of stellar distance determination.