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.
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.
Related
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.
A worked example with numbers
Take L1 = 0.25 m and L2 = 0.20 m, with the target at x = 0.30 m, y = 0.20 m.
- Distance squared = 0.30² + 0.20² = 0.13, so d = 0.361 m. This lies between 0.05 and 0.45 m, so it is reachable.
- cos(elbow) = (0.13 − 0.0625 − 0.04) ÷ (2 × 0.25 × 0.20) = 0.0275 ÷ 0.10 = 0.275, so the elbow angle is 74.0 degrees (the other solution is −74.0).
- The direction to the target is atan2(0.20, 0.30) = 33.7 degrees.
- The correction angle is atan2(0.20 × sin 74.0°, 0.25 + 0.20 × cos 74.0°) = atan2(0.1923, 0.305) = 32.2 degrees.
- Shoulder = 33.7 − 32.2 = 1.5 degrees for the +74.0 elbow, or 33.7 + 32.2 = 65.9 degrees for the −74.0 elbow.
Check with forward kinematics: x = L1 cos(θ1) + L2 cos(θ1 + θ2) and y = L1 sin(θ1) + L2 sin(θ1 + θ2). With θ1 = 1.5 degrees and θ2 = 74.0 degrees, x ≈ 0.300 m and y ≈ 0.200 m, which matches the target.
Assumptions and limits
- Angles are measured with the first link along the x axis and the elbow angle relative to the first link. Other conventions give different numbers for the same pose.
- Real servos have limited travel, so one of the two solutions may not be reachable.
- Near full extension or full fold the arm is at a singularity. A small move of the target then needs a large joint move.
- A real arm sags under load, and backlash in the joints adds error.
Common mistakes
- Reporting the elbow angle in degrees but feeding it to a library that expects radians.
- Choosing the solution without checking it against the joint limits.