If you get the vaccine between the ages of 9 and 14, you only need two doses (delivered as two shots), as long as you get them less than 6 months apart. If you get the doses more than 6 months apart, you’ll need a third dose.
If you get the vaccine when you’re 15 or older (you can now get it up to age 45), you need three shots to get the best protection from HPV. However, research does suggest that even one dose can offer some protection. Ideally, you should get the 2nd and 3rd shots within one year of getting the 1st one.