NO! You do not need to get a masters degree before enrolling in a Ph.D. program, and the majority of new Ph.D. students do not have one. In fact, if you know you want a Ph.D., it is a bad idea to enroll in a masters program first. Let’s consider the pros and cons.
(There’s a video version of this answer.)
Having an MS provides few advantages
Except in one case (see below), having a masters degree does not give you a significant advantage during the application process. Ph.D. programs regularly admit many students who have just completed their undergraduate degree. For instance, in a recent year, the admit rate for UCSD’s Ph.D. program is around 7% for students with a masters and around 13% for students with an undergrad degree. And 60% of admitted students had only an undergrad degree.
The main practical impact having an MS will have as you start a Ph.D. program is that you can focus more intently on research more quickly, since you won’t have as many distracting classes to take. However, since you spent two years getting your masters, you’ll end up taking roughly the same number of classes either way (or perhaps more if you get your MS first – see below).
In the end, you’ll wind up with an MS degree in addition to your Ph.D., anyway: Usually, when you finish the course work for your Ph.D. you incidentally satisfy the requirements for a masters at the same time. This also provide a convenient “off ramp” from a Ph.D., if you decide it’s not for you – you can just take your master’s degree, leave, and get a great job.
Getting an MS first is usually a bad idea, if you know you want a Ph.D.
There are two reasons that enrolling in a MS program first is a bad choice, if your ultimate goal is to get a Ph.D.
First, Ph.D. students get paid to go to school while MS students don’t : The Taulbee Survey (Tables M6 and G1) reports that while 84% of Ph.D. students are fully supported on a TA, RA, or fellowship, while only 6% of MS students are supported (which means that 94% are paying their own way).
Second, the course work requirements for your Ph.D. program may not line up with the courses you took for your MS. In this case, you’ll end up taking more classes if you do the MS first and at a different school.
So, if you suspect you might want a Ph.D., apply to and enroll in a Ph.D. program!
When it might make sense to get an MS first
The one exception to above might be if your undergraduate grades/project experience are not good enough to get into the Ph.D. program you want and you are determined to get a Ph.D. In this case, you could enroll in an MS program, excel at it, and then apply to Ph.D. programs.
You will likely need to do very well in the MS program since Ph.D. admissions committees often hold MS-holding applicants to a higher standard than students straight out of undergrad.
Even in this case, though, you should apply to Ph.D. programs and MS programs at the same time: You might get in at a Ph.D. program and save yourself the MS tuition, money, and time.
Another alternative in this situation would be to go work for a couple years and demonstrate your skill and determination while getting paid, and then use that to bolster your Ph.D. applications.