Robot arm playground: two-link inverse kinematics you can drag

Drag the target and see the two joint angles that put the hand on it. Change the link lengths to see how reach and the unreachable zone change.

Shoulder angle: – degreesElbow angle: – degreesHand position: – m

Drag or tap the canvas to move the target. This is a flat two-link arm, so it shows the geometry of inverse kinematics, not a full 3D arm.

How it is calculated

For a target at distance d from the shoulder, the elbow angle comes from the law of cosines: cos(elbow) = (d² − L1² − L2²) ÷ (2 × L1 × L2). The shoulder angle is the direction to the target minus a correction angle, atan2(L2 × sin(elbow), L1 + L2 × cos(elbow)). Elbow up and elbow down are the two mirror solutions. The arm can reach any distance between the difference of the two link lengths and their sum.

A worked example

With links of 0.25 m and 0.2 m the arm reaches out to 0.45 m and cannot reach closer than 0.05 m to the shoulder. Drag the target beyond 0.45 m and the dot turns red while the arm stretches toward it.

Common mistakes

  • Forgetting that every reachable point has two solutions, and picking the one that hits the base.
  • Ignoring joint limits. Real servos rarely turn a full circle.
  • Using this flat model for an arm that also rotates at its base.

inverse kinematics of a 2-link arm in Python, robot arm kinematics basics, servo torque calculator.

Last reviewed: November 2026. This tool runs in your browser and sends nothing anywhere. Treat its output as a first check, not a guarantee.