The cost of completing a degree in the US is basically dependent on ONE factor: cost of a credit hour (excluding living expenses). Of course, there are other things associated to the credit hour. Tuition is a combination of out state and in state. Residents of the particular state where the university resides pay in state tuition only. The rest whether they are US citizens, permanent residents or foreign nationals pay both. That said, every degree clearly states the number of credit hours needed in the degree requirements. Like I mentioned before, tuition for each credit hour (in state + out state) multiplied by the total number of credit hours gives the final figure.
So, a student needs to understand that the length of time does not have to be the correct variable in calculating the final cost. A student may take 36 credit hours in 3 semesters or 4 semesters. Taking more credit hours works but there is a limit on the number of hours a student is permitted to enroll per semester. One must weigh in the amount of additional work needed when signing for extra credit hours than the required norm (which is 9 hours of graduate international students and 12 hours for undergraduate international students).
There are some exceptions to the above formula. Very few employe those and hence, I will not talk about them in this article. Also, universities increase their tuition every now and then annually (1-5% usually). When a student attends for multiple years, these increases will alter the final cost, but not by much.