ToolSphere

Inverse Kinematics 2R Arm Calculator

Robotics

Joint angles for a 2- or 3-link planar arm to reach a target x, y (and tool angle), with both elbow solutions, a reach check and a live drawing.

Type the arm lengths and the point you want the tip to reach. The answer is the joint angles to set.

Target coordinates

Set the joints to

θ165.92°
θ2-74.04°

Elbow down reaches the same point with θ1 = 1.46°, θ2 = 74.04°.

On this browser only

Give feedback

Did this tool help?

Tell us what worked, what didn’t, or what you’d like next.

Opens Google Forms in a new tab with this tool’s name filled in. No sign-in or email required. Feedback is optional.

How to use Inverse Kinematics 2R Arm Calculator

  1. 1Enter the link lengths L1 and L2 (mm). For a 3-link arm, switch to 3 links and enter L3 and the tool angle φ the last link must point at.
  2. 2Type the target x and y, or drag the sliders; they span the arm's full reach.
  3. 3Choose Elbow Up or Elbow Down; the other solution is listed under the result.
  4. 4Read θ1, θ2 (and θ3) and check the drawing. An unreachable target says whether it is too far or too close, and by how much.

About Inverse Kinematics 2R Arm Calculator

From a target point to joint angles

Forward kinematics turns joint angles into a tip position; inverse kinematics (IK) goes the other way, which is what a robot actually needs when told "move the gripper here". For a two-link planar arm with link lengths L₁ and L₂ there is a closed-form answer. The distance from the base to the target fixes the elbow angle by the law of cosines:

cos θ₂ = (x² + y² − L₁² − L₂²) / (2 L₁ L₂)

and the shoulder angle then follows from the direction of the target, corrected for where the elbow puts the forearm:

θ₁ = atan2(y, x) − atan2(L₂ sin θ₂, L₁ + L₂ cos θ₂)

Because cos θ₂ is the same for +θ₂ and −θ₂, there are two solutions: elbow up and elbow down, mirror images that put the tip on the same point.

Worked example

With the default L₁ = 100 mm and L₂ = 80 mm, reach the target (120, 80):

  • x² + y² = 14400 + 6400 = 20800, so cos θ₂ = (20800 − 10000 − 6400) / (2 · 100 · 80) = 4400 / 16000 = 0.275, and θ₂ = ±74.04°.
  • Elbow up: θ₂ = −74.04° gives θ₁ = 65.92°. The elbow sits at (40.8, 91.3), above the target.
  • Elbow down: θ₂ = +74.04° gives θ₁ = 1.46°. The elbow sits almost on the x axis, below the target.

Run either pair through forward kinematics and the tip lands back on (120, 80): the quickest way to check an IK answer.

When there is no solution

The target must lie in a ring around the base: no farther than L₁ + L₂ (arm fully stretched) and no nearer than |L₁ − L₂| (arm fully folded). Outside it, the formula gives |cos θ₂| > 1 and the tool reports the target as unreachable. For the default arm the ring runs from 20 mm to 180 mm; (120, 80) is 144.2 mm away, inside it.

Three links with a tool angle

A third link in the same plane gives the arm a wrist, and usually you care which way the tool points as well as where it is: a gripper has to approach a part from above, a pen has to meet the paper square. Give the tool angle φ (measured from the x axis) and the problem has a closed form again:

  1. Step back from the target along the tool direction by L₃ to find the wrist point: W = (x − L₃ cos φ, y − L₃ sin φ).
  2. Solve the two-link arm for W exactly as above.
  3. The last joint makes up the rest of the tool angle: θ₃ = φ − θ₁ − θ₂.

With L₁ = 100, L₂ = 80, L₃ = 50 mm, target (150, 60) and φ = −30° (tool tilted 30° below horizontal), the wrist is at (150 − 50 cos(−30°), 60 − 50 sin(−30°)) = (106.70, 85.00), 136.42 mm from the base, so cos θ₂ = 0.1381 and θ₂ = ±82.06°:

  • Elbow up: θ₁ = 74.05°, θ₂ = −82.06°, θ₃ = −21.99°
  • Elbow down: θ₁ = 3.03°, θ₂ = 82.06°, θ₃ = −115.10°

Both sets add up to −30°, the tool angle. A 3-link target can be in reach for one tool angle and out of reach for another: what has to fit inside the 2-link ring is the wrist point, not the tip.

Choosing elbow up or down

The maths does not prefer one. Real arms choose by what is in the way (a table, the robot's own body), by which solution is closer to the current pose so the joints move less, and by joint limits: a servo that turns only 0–180° may reach one solution and not the other.

Beyond this

Without a fixed tool angle, a 3-link planar arm has infinitely many solutions (the wrist can sit anywhere on a curve), and real controllers pick one numerically, for example with the Jacobian, minimizing joint motion. Industrial six-axis arms such as the PUMA 560 have closed-form solutions worked out per robot. To see what any set of joint angles does on a full arm, enter its DH table in the DH parameters calculator; to size the motors for the pose, use the joint torque calculator.

Guides and tutorials

Frequently asked questions

How do you solve inverse kinematics for a 2-link arm?

Use the law of cosines for the elbow, cos θ2 = (x² + y² − L1² − L2²) / (2·L1·L2), then θ1 = atan2(y, x) − atan2(L2·sin θ2, L1 + L2·cos θ2). Taking θ2 positive or negative gives the elbow-down and elbow-up solutions.

Why are there two solutions?

cos θ2 has the same value for +θ2 and −θ2, so the elbow can bend either way and the tip still reaches the same point. They are mirror images about the line from the base to the target.

When is a target unreachable?

When its distance from the base is more than L1 + L2 (too far) or less than |L1 − L2| (too close for the arm to fold onto). Then |cos θ2| would exceed 1, which no angle can satisfy.

Are the angles in degrees or radians?

The tool shows degrees. θ1 is measured from the positive x axis, and θ2 is the elbow angle relative to the first link, so θ2 = 0 means the arm is straight.

How can I check an inverse kinematics answer?

Put the angles back into forward kinematics: x = L1·cos θ1 + L2·cos(θ1 + θ2) and y = L1·sin θ1 + L2·sin(θ1 + θ2). If the result is the target, the answer is right. The forward kinematics tool does this and draws the arm.

Does it do 3-link inverse kinematics?

Yes, for a planar arm when you give the tool angle φ: switch to 3 links, enter L3 and φ, and it solves through the wrist point W = (x − L3·cos φ, y − L3·sin φ), then sets θ3 = φ − θ1 − θ2. Without a tool angle a 3-link arm has infinitely many solutions.

Does it work for a 6-axis arm?

No. Six-axis arms need a robot-specific closed form or a numerical solver. The DH parameters calculator handles the forward direction for arms of any length, so you can check a pose you have solved elsewhere.

What is elbow up and elbow down?

The two ways the elbow can bend to reach the same point. Here elbow up means a negative θ2 (the elbow bends clockwise, so for a target in front of the arm the elbow sits above the line to the target) and elbow down a positive θ2. The tool shows the one you pick and lists the other.

Why does θ1 sometimes jump by 360°?

It doesn't change the pose: θ1 is reported between −180° and 180°, so an angle of 190° appears as −170°. If your joint has limits, convert to the range your controller uses.

Have a suggestion for Inverse Kinematics 2R Arm Calculator?Share your feedback ↗