It depends on the country you study in, whether you do part time or full time, whether you work at the same time, whether you do a taught or research degree, the subject area, the complexity of the topic studied, and how committed you are to writing it up.
If we take it as general, the best case scenario is 3.5 to 4 years, the avg case is about 5 years, and the worse case scenario we can say its about 7+ years. Actually, most students that take 7+ years usually don’t finish at all.