It's often bad form that causes knee pain during squats. One reason is squatting with the knees too far forward. It should be the glutes taking the brunt of your weight, not your knees, so make sure the knees stay behind the toes. Also, keep your knees in alignment with the toes. Twisting them in or out could place unnecessary stress on the joints. Want more details? Check out these step by step instructions:
Stand with feet about hip or shoulder-width apart, toes at a natural angle forward or slightly out.
If you're using weights, hold dumbbells at your sides or rest a barbell on the shoulders. If you're a beginner, you may want to start with no weights and take the arms out, as shown, for balance.
Bend the knees and squat, pushing your rear out as though you're about to sit in a chair. Your knees should stay behind the toes.
As you're squatting, keep the knees going in the same direction as the toes and avoid arching or rounding the back. Instead, keep a neutral spine and pelvis.
Squat as low as you can or until the thighs are parallel to the floor. Some advanced exercisers or athletes may be able to do full squats, but parallel squats are usually recommended for the average exerciser.
At the bottom of the movement, make sure your feet are flat on the floor, your knees are still in line with and behind the toes and that you aren't arching the back.
Push back up, concentrating on squeezing the glutes as you stand.
Practice your form and spend some time going through the motion to get a feel for your strength and flexibility. Go slowly to keep the knees straight and see if that makes a difference in any knee pain you've been feeling.