› Inverse Kinematics Calculator Back
Robotics · IK Solver

Robot Arm Inverse Kinematics Calculator (2/3-DOF)

Compute joint angles for a 2R planar or 3R spatial model from a target position. In 3R mode L₁ and L₂ determine the calculated position; L₃ is drawn for reference only.

Parameters
Mode
Link Lengths
L₁ Link 1
mm
L₂ Link 2
mm
L₃ Link 3
mm
Target Position
Target X
mm
Target Y
mm
Target Z
mm
Joint Limits
θ₁: ±150°, θ₂: ±170°, θ₃: ±170°
Results
—
θ₁ [deg]
—
θ₂ [deg]
—
EE Error [mm]
—
det(J)
—
Reachability
—
Singularity Dist.
Inverse Kinematics Solution
Moving a slider switches to manual control
Theory & Key Formulas

Both solutions follow from the cosine of the second joint angle:

$$c_2 = \frac{x^2+y^2-L_1^2-L_2^2}{2L_1 L_2}, \quad s_2 = \pm\sqrt{1-c_2^2}$$ $$\theta_2 = \text{atan2}(s_2, c_2)$$ $$\theta_1 = \text{atan2}(y,x) - \text{atan2}(L_2 s_2,\ L_1+L_2 c_2)$$

Reachability: $|L_1-L_2| \le \sqrt{x^2+y^2} \le L_1+L_2$. The 3R spatial mode finds θ₁–θ₃ with a damped Gauss–Newton iteration $\Delta\theta=(J^TJ+\lambda I)^{-1}J^T(\mathbf{x}^*-\mathbf{x})$ (λ=0.01, 24 iterations); L₃ is drawn for reference only and is not included in the end-effector position.

What Is Robot Arm Inverse Kinematics?

🙋
What is inverse kinematics? I heard it finds the "joint angles" from the "target position", but how does it differ from forward kinematics?
🎓
Roughly speaking, forward kinematics computes "if I bend the joints by this much, where does the hand go?" Inverse kinematics is the reverse: "I want the hand here! How many degrees must each joint bend?" For example, when you change the values of "Target X" and "Target Y" in this simulator, the arm's posture changes a lot, and that motion is driven by the angles computed by inverse kinematics.
🙋
Sometimes there are two arm shapes for the same target position! The display says "elbow up" and "elbow down". Why are there two solutions?
🎓
Good catch. For a two-link arm there are generally two ways to bring the hand to the same position: elbow up or elbow down. Mathematically it corresponds to choosing plus or minus in $s_2 = \pm\sqrt{1-c_2^2}$. In practice you choose the one that does not collide with nearby machines or that stays within the joint range. This tool shows both postures (elbow up / down) at the same time in different colours, so compare them.
🙋
Sometimes a "singularity" warning appears. The arm is fully stretched out and seems to go wild when I try to move it... what is happening there?
🎓
That is exactly a "singularity", one of the states that need the most care in robot control. When the arm is fully extended or folded, trying to move the hand in a certain direction (along the arm) makes the joint velocity theoretically diverge to infinity. In the simulator, set "Link 1" and "Link 2" to about the same length and move the target as far as it will go in the X direction (moving a slider stops the auto-follow). The arm should become a straight line and "singularity" should appear. On the shop floor the iron rule is to plan paths that avoid this posture.

Frequently Asked Questions

In the 2R model the cosine rule gives two possible signs for sin θ₂. This tool calls the positive branch elbow down (blue) and the negative branch elbow up (green). The branches coincide at singular poses, and joint limits may exclude one or both. The tool does not check collisions.
For 2R, fully extended or folded configurations have a zero Jacobian determinant and are singular. Some end-effector directions cannot be produced instantaneously, and near a singularity a specified end-effector velocity can require large joint velocities. Not every joint velocity becomes infinite.
Targets outside the maximum or minimum reach have no solution. With joint limits off, a grey posture shows the nearest geometric position and its distance to the target. With joint limits on and no solution, the tool does not calculate the nearest feasible posture, so it shows a dash for angles and error.
The 3R spatial mode of this tool places the end effector at a three-dimensional target (x,y,z) with three joints: base rotation θ₁, shoulder θ₂ and elbow θ₃. Instead of an analytical solution it runs up to 24 iterations of a damped Gauss–Newton method (Jacobian pseudo-inverse, λ=0.01, step factor 0.5) to find θ₁–θ₃, and reports "Reachable" if the end-effector error is below 10 mm and "Not converged" otherwise. The third link L₃ is drawn only and is not included in the end-effector position.
The Jacobian J maps joint angular velocities to end-effector velocity (dx/dt = J·dθ/dt). The 2R mode uses an analytical cosine-rule solution; the 3R mode uses a damped iterative method. Redundancy depends on the number of independent joints relative to the dimensions of the task, not simply on having three or more joints.
With joint limits off, the 2R workspace spans radii |L₁−L₂| to L₁+L₂. Equal link lengths give a zero inner radius; unequal lengths leave a circular region near the origin unreachable. Change L₁ and L₂ to compare the diagrams. Joint limits restrict the actual reachable region further.
A single end-effector position or pose can correspond to several joint configurations. Switching solutions during motion can cause abrupt joint movements. Real motion planning must account for joint limits, collisions and continuity. This tool displays the valid 2R branches together; it does not plan a path or check collisions.
This tool shows a kinematic solution for the entered target. It does not model inertia, friction, motor torque or the control system, so it cannot predict real tracking time. Change the target using the sliders or numeric inputs.

Real-World Applications

Industrial robots (welding, handling): Welding robots in car factories must bring the torch precisely to prescribed positions on the body. Inverse kinematics computes the target angle of each joint quickly and realises smooth paths. Path planning that avoids singularities is essential for safe operation.

Surgical assistance robots: In endoscopic surgery the forceps tip is positioned precisely at the site following the surgeon's commands. To avoid obstacles (other organs) in the confined space inside the patient, the best posture (elbow up / down) is chosen from several inverse-kinematics solutions.

Animation and CG production: Inverse kinematics is used heavily to bring a character's hands and feet to specific positions with natural motion. Setting joint-range limits lets natural, human-like motion be generated automatically.

CAE analysis of articulated structures: For structural analysis (FEM) of robot arms and construction machinery, a realistic loaded posture must be set as the initial state. The joint angles from inverse kinematics are used to define the initial posture of the analysis model realistically.

Common Misconceptions and Points to Note

First, there is the misconception that "longer links are always better". Longer links do extend the reach, but the arm falls into singularities (straight-line postures) more easily and control becomes unstable. For example, aiming an arm with L₁=L₂=300 mm at the target (595, 0) just reaches it but approaches an exact singularity, and you can simulate the "thrashing" in which small position commands make the joints move abruptly. In practice choose the minimum arm length needed for the workpiece size and design a workspace with margin.

Next, the attitude that "as long as a solution is found, that's fine". Even if an angle is computed mathematically, it often exceeds the robot's physical joint range. For example, if a joint whose θ₂ range is −120° to 120° gets a computed 150°, that must be judged "unreachable". If both postures hit the joint limits even when you switch solutions in this tool, that position is effectively unreachable.

Finally, the over-confidence that "with three degrees of freedom you can reach anywhere in 2-D freely". The 3R of this tool is a spatial arm with base rotation, and its three joints match the three-dimensional position of the tip, so the tool orientation cannot be controlled. By contrast, three joints in a plane leave one joint spare for two position components, and inverse kinematics then has infinitely many solutions (redundancy). The iterative solution of this tool only shows the one solution that converged from the initial guess; on real machines this grows into an advanced optimisation problem of choosing "the solution with the least joint load" or "the smoothest motion" from infinitely many.

How to Use

  1. Enter the link lengths L₁, L₂, L₃ in mm (100–600 mm each; defaults L₁=200, L₂=150, L₃=120 mm; L₃ is shown only in 3R spatial mode)
  2. Specify the target position (x,y) or (x,y,z) in mm from the origin. Initially the target moves automatically along a path; moving a slider switches to manual control (press "Auto-follow target" to resume)
  3. Choose the mode: 2R planar uses the analytical solution for θ₁, θ₂; 3R spatial uses 24 iterations of a damped Gauss–Newton method (Jacobian pseudo-inverse)
  4. When both elbow-up and elbow-down solutions exist they are drawn together, and the Jacobian determinant det(J) flags singularities (a "near singularity" warning when |det(J)| is below 5000 mm²)
  5. Check reachability and pose quality on the cards: end-effector error [mm], reachability and singularity distance |det(J)|/(L₁L₂)=|sin θ₂|. Switching "Joint limits" on excludes solutions outside θ₁: ±150°, θ₂, θ₃: ±170°

Worked Example

In 2R planar mode with the target set manually to the defaults (L₁=200 mm, L₂=150 mm, target (x,y)=(200 mm, 150 mm)), the target distance is √(200²+150²)=250 mm, inside the reachable range |L₁−L₂|=50 mm to L₁+L₂=350 mm. The analytical solution returns the elbow-down solution θ₁=0.0°, θ₂=90.0° (and the elbow-up solution), with Jacobian determinant det(J)=30000 and singularity distance |det(J)|/(L₁L₂)=1.0, well away from a singularity. For a target at (360 mm, 0 mm), which exceeds L₁+L₂=350 mm, the tool reports "Unreachable" and shows the 10 mm shortfall as the end-effector error. Note that the iterative solution of the 3R spatial mode does not yet include link L₃ in the forward kinematics, so L₃ does not affect the reach calculation (reference display only).

Practical Notes

  1. This tool covers rigid-link kinematics only. On real machines link deflection, gearbox backlash and play become end-effector errors, so correct them by calibration and keep a margin on the computed values
  2. The tool warns "near singularity" when |det(J)| is below 5000 mm² (with the default link lengths |sin θ₂| below about 0.17, i.e. poses close to full extension or full fold). Insert via-points that avoid this region in trajectory planning
  3. The 3R spatial iteration starts from θ₂=0.3 rad, θ₃=−0.3 rad and stops after 24 steps; an end-effector error of 10 mm or more is reported as "Not converged". It does not converge for targets that are too far or too near or at singular poses, so change the target and retry

🎬 Watch it in motion

Ratchet & Pawl | the wheel that never turns back #Shorts
Ratchet & Pawl | the wheel that never turns back #Shorts
Scotch Yoke | a perfect sine wave, cut in steel #Shorts
Scotch Yoke | a perfect sine wave, cut in steel #Shorts
Cam & Follower | the profile IS the program #Shorts
Cam & Follower | the profile IS the program #Shorts
Geneva Mechanism | it spins non-stop, yet the output keeps stopping #Shorts
Geneva Mechanism | it spins non-stop, yet the output keeps stopping #Shorts
Four-Bar Linkage | four rods turn rotation into a controlled swing #Shorts
Four-Bar Linkage | four rods turn rotation into a controlled swing #Shorts
Projectile Motion | the safety parabola you can't beat #Shorts
Projectile Motion | the safety parabola you can't beat #Shorts