In general, randomized clinical trials (RCT) in dentistry involve longitudinal observations. In such studies, the total cost is a function of the number of study subjects and visits, the study duration, and the type and number of examinations at each visit. In this paper, we derived the minimum cost design for longitudinal RCTs with 2 treatment arms and multiple visits. We optimized the number of subjects, visits and repeated measurements under the constraints of the requirements for statistical significance, power and minimum total study cost. A SAS macro was written and made available on the World Wide Web, so interested clinical investigators can easily find optimal designs. The application of the program is illustrated using an example.