Because hamstring stretches stretch the back of the legs as well as opening the backs of the knees and hip joint, they are also known as forward bending yoga poses.
However, not all forward bends are hamstring stretches.
You may find that doing low lung hip extensor stretch first makes the following seated hamstring stretches a little bit easier.
Also, if your hamstring flexiblity is extremely limited you might find it more effective to do standing hamstring stretches first.
In the following seated hamstring stretches 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 "Pashcimottanasana").
You could also pull the legs (one leg at a time) towards the front of the body as shown below (Compass Pose preparation).
In both types of hamstring stretches, the knees are straight (or as straight as possible.)
This can be made more pleasant if you focus on feeling your breath.
Generally, the seated wide legged forward bend is the easiest of seated hamstrings stretches.
Janu Sirsasana A is also a seated hamstring stretch. However only one leg is straight in this yoga pose.
As with the wide legged seated forward fold, 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 turning your body so that your torso is reaching over your straight leg.
In the photos below I'm turned towards my straight leg.
If your bent knee doesn't touch the floor 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 foot into the floor as you lengthen your spine. (The foot of the bent knee leg that is.)
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.
After doing the above seated hamstring stretch on both sides you can then do a seated hamstring stretch with both legs together. This is easier with the feet about hip-width apart (my favored position.) It can become a lot more uncomfortable with feet 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.
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).