PPT Slide
A. Calculating the pairwise distances
A pair of sequences is aligned by the usual dynamic programming algorithm, and then a similarity or distance measure for the pair is calculated using the aligned portion (gaps excluded) - for example, percent identity.
CLUSTAL W does not correct these distances for multiple substitutions (e.g., by the Jukes-Cantor formula), although other programs do, and it is sometimes an option in different versions of the program.