The hamstrings are the muscles that run up the back of the thigh. They act on both the back of the knee and the back of the hip. And so to stretch the hamstrings, bend the hip forwards with the knee straight.
If bending the hip forward with the knee bent, only the hip extensors (the muscles at the rear of the hip joint) are stretched.
If bending the hip forwards with the knee straight then the hamstrings are stretched.
Because this action will be limited by hamstring flexibility, the hip extensors may be stretched when bending forwards with the knee straight, but to a lesser extent than when the knee is bent.
If you have tight hamstrings then it can be helpful to focus on keeping the back straight when doing forward bending yoga poses. This way, the focus is on opening the back of the hips, rather than bending the spine forwards. (Read more about doing a hunchback free seated forward bend.)
If your hip extensor are tight, you may find it helpful to do a hip extensor stretch like low lunge prior to stretching the hamstrings.
Even if your hip extensors aren't tight, you can use hip extensor stretches to get used to the feeling of bending your hip forwards.
If you have tight hamstrings and have difficulty stretching them you might find it easier to start with standing hamstring stretches.
You may also find hamstring stretching easier if you also do hamstring strengthening exercises.
In either case, you may find it helpful to learn to activate your hamstrings, gluteus maximus, quads and hip flexors. Then you can do active hamstring stretches using muscle control for better flexibility.
In seated yoga hamstring stretches you may find that pressing down through the backs of the legs helps improve hamstring flexibility.
Do it in such a way that your legs feel strong.
Some instructors may shy away from this instruction because of the tendency for those with hypermobile (or hyper extensible) knee joints to hyper extend the knee. However in a seated stretch for the hamstrings this is less of a concern.
(And more importantly, for those who have difficulty stretching the hamstrings in the first place, this may be one action that helps.)
If you're hamstrings are so tight that you can't sit upright with the legs straight then this action may not work. (You could try sitting on an inclined sit up bench so that your butt is higher than your feet so that you can then lean your upper body forwards. Or focus on standing hamstring stretches. Frictional Arm and Leg Strength shows one way of activating the leg muscles in standing poses. You may find that it helps with improving your hamstring flexibility.)
In the seated hamstring stretches pictured below, you can stretch the hamstrings either by tilting the pelvis forwards relative to the pelvis (such as in " Wide Leg Seated Forward Fold", " Janu Sirsasana A", or " Paschimottanasana").
You could also pull a leg towards the front of the body using the arms as in Compass Pose preparation (Shown below). You can always use a towel or belt if you can't easily grab your foot, and something that you could try is pressing your foot into your hands as it trying to resist the stretch.
In both types of hamstring stretches, the knees are straight (or as straight as possible.)
These stretches can be made more pleasant if you focus on feeling your breath. In addition, if pressing the floor (or working against your hands) you can synchronize those actions with your breath. Try inhaling and pressing or resisting. Then, as you exhale, relax.
Generally, the seated wide leg seated forward bend is the easiest of seated yoga hamstrings stretches.
You can use gravity to assist your stretch, or to give you something to work against so that you strengthen you hamstrings as you stretch them.
In Janu Sirsasana A you stretch one set of hamstrings at a time.
Prior to bending forwards in this yoga hamstring stretch, you can first practice lengthening your spine while seated upright.
In the pictures below I'm turned forty-five degrees in from my straight leg while I practice straightening and relaxing my spine.
Bending forwards you can first bend forwards while facing between both legs.
If you start of with this variation, shown below, you can increase the difficulty of the pose by gradually shifting your body relative to your legs (use your hands to help walk your torso towards your straight leg) so that your torso ends up reaching over your straight leg.
If your bent knee doesn't touch the floor in this pose, you can either place a block beneath it so that you can then press that leg down against the block, or focus on pressing the outer edge of the bent-knee foot into the floor as you lengthen your spine.
In Janu Sirsasana B position your pelvis so that your anus is on top of your heel. Then bend forwards.
You can point the bent knee foot to the side or forwards.
Try both variations and notice how they feel.
Here are some suggestions for getting comfortable in the Janu Sirsasana C foot position as well as some modifications.
You may find that bending forwards with both knees straight is easier if you first do some of the above poses where you bend forwards with only one knee straight. The seated yoga hamstring stretch with both knees straight (and feet together) is called paschimotanasana. In some options you grab the big toes or feet in some way. To start of with though, just place your hands on the floor.
Note that stretching the hamstrings with feet together is more difficult (more uncomfortable) that with feet about hip width apart. And so you could start with your feet hip width and then move them closer together.
As with the wide leg seated front fold, you can also do this seated forward bending yoga pose with knees bent.
As you tilt further and further forwards in this yoga pose, try to widen the top of your inner thighs (close to the groin) while keeping your feet in the same position. With inner thighs widened, press your inner thighs downwards so that you can use your psoas and iliacus to help tilt your pelvis forwards. Or focus on using your outer glutes (gluteus minimus and medius) to help tilt your pelvis forwards relative to your thighs.
The pictures below show lengthening the spine while sitting upright with knees bent.
You can practice the same thing, lengthening the spine and reaching the arms forwards, with your pelvis tilted forwards a little bit. You can do this with knees straight (shown) or with knees bent (not shown.)
In either case, press your legs down as you lengthen your spine.
Finally, as your hamstrings lengthen, or to deepen the stretch of your hamstrings, try to reach forwards even further. But rather than bending your spine focus on lengthening it as you inhale.
If you find that your back rounds excessively in this pose or you have difficulty lengthening your spine the tips in seated forward bend may help.
A slightly different way to stretch the hamstrings is to grab on to the foot or big toe (or ankle) with one or both arms and while pressing the knee down, pull up with the arm to help pull the ribcage down, towards the thigh.
Rather than relaxing the leg, keep it active and actively resist the arm. The action of the leg pressing down and the arm pulling up may help bring your ribcage closer to your thigh.
Keep the chest open and neck long when doing this action also.
This option can be used in most (if not all) of the asymmetric seated hamstring stretches above.
In the previous seated hamstring stretches you tilted you pelvis forwards relative to your thigh (or attempted to.)
In this compass pose preparation, you can move the leg relative to the pelvis to stretch the hamstrings, one leg at a time.
Here too you can lengthen your spine. You can also press the foot of your bent knee leg into the floor. But so that you can straighten your leg in this yoga pose, relax your shoulders.
I've included a step-by-step in seated hamstring stretch.
If you can straighten your leg in the above pose then you might want to give compass pose a try.
You may find that it feels good to do Ardha Matsyendrasana after doing modified heron pose or just before it.
Since seated hamstring stretches tend to stretch the hamstrings and open the back of the body, you can counter pose them by opening up the front of the body with back bending yoga poses like table top yoga pose and or reverse plank pose (purvottanasana).
For more on the anatomy related to the hamstrings (and the glutes) you can read hamstring anatomy.
For more on hip anatomy in general you can read hip joint anatomy.
For more on strengthening the hamstrings (and learning to activate them) read Hamstring Strengthening Exercises.
So how do you go about using the hip flexors to stretch the hamstrings?
How do you learn to activate them?