Math

Quaternion Calculator

Multiply, normalise and invert quaternions, convert between quaternions, axis-angle and Euler angles, and rotate a vector, with gimbal lock detected and explained.

Last reviewed by the Radiatus Cloud team

Results appear here.

Need this done properly for your business?

Radiatus delivers secure cloud, DevOps & compliance engineering.

Book a free consult

Why 3D rotation uses four numbers

Three Euler angles seem sufficient for three rotational degrees of freedom, and they fail in a specific way. When the middle rotation reaches ninety degrees, the first and third axes align and one degree of freedom disappears, which is gimbal lock. A quaternion carries a redundant fourth component that removes the singularity entirely, so no orientation is special and every rotation can be represented and interpolated smoothly. This is why games, robotics, aerospace and physics engines all store orientation as quaternions and convert to Euler angles only for display.

Multiplication is composition and does not commute

Multiplying two quaternions composes their rotations, and the order matters exactly as it does for rotations themselves: rotating ninety degrees about x then ninety about y gives a different result from the reverse. This is a property of rotation, not a quirk of the notation. The identity quaternion, with a scalar part of one and a zero vector part, represents no rotation at all, and the conjugate of a unit quaternion is its inverse, which makes undoing a rotation almost free.

Normalisation and the double cover

Only unit quaternions represent rotations, and repeated multiplication accumulates floating point error that gradually pushes the magnitude away from one, so renormalising periodically is required in any long running simulation. A subtler property is that a quaternion and its negation represent the same rotation, which means orientation space is covered twice. Interpolation code has to pick the shorter path between two quaternions, or an animation takes the long way round for no visible reason.

Related tools

  • Percentage Calculator — Calculate percentages, percentage change, increase and decrease, and reverse percentages, with the working shown for each result.
  • Statistical Calculator — Calculate mean, median, mode, standard deviation, and more.
  • Probability Calculator — Calculate probabilities for single and combined events, including conditional probability and Bayes' theorem.
  • Scientific Calculator — Perform advanced mathematical operations including trig, log, and exponents.

Frequently Asked Questions

What is gimbal lock?

The loss of one rotational degree of freedom when two Euler axes align, which happens when the middle angle reaches ninety degrees. Quaternions have no such singularity, which is the main reason they are used for storing orientation.

Why does quaternion multiplication not commute?

Because rotation composition does not commute. Rotating about x then y genuinely gives a different orientation from rotating about y then x, and the algebra reflects that rather than causing it.

Why must quaternions be normalised?

Because only unit quaternions represent rotations. Repeated multiplication accumulates floating point error that drifts the magnitude away from one, which shows up as scaling or skew unless the value is periodically renormalised.

What is the double cover?

A quaternion and its negation represent exactly the same rotation, so every orientation has two representations. Interpolation must choose the shorter path between two quaternions, or the animation rotates the long way round.

When are Euler angles still useful?

For display and for human input, where three named angles are far easier to reason about than four components. The usual practice is to store quaternions internally and convert at the interface, converting back immediately rather than accumulating rotations in Euler form.

Privacy & Security

Everything runs in your browser; nothing is uploaded.

Data: None
Client-side-Side
Active
v1.0

How to Use

Enter quaternions or an axis and angle to compute rotations and conversions.

Disclaimer: This tool is provided "as is" without warranty of any kind. Results are for educational and utility purposes.