Euler angles and quaternions converter

Convert between Euler angles, quaternions, axis-angle and matrices. Includes 3D preview, normalization, JSON output and snippets for Unity, ROS and Python.

Euler angles ↔ quaternions (roll, pitch, yaw)

Convert XYZ rotations into quaternions, axis–angle, matrices, JSON and reusable snippets.

This calculator converts XYZ Euler angles (roll, pitch, yaw) to normalised quaternions for 3D rotations and back again, which is essential in robotics, drones and 3D/game engines to avoid gimbal lock and interpolate orientations smoothly.

Fixed convention: intrinsic XYZ, right-handed system, R = Rz(yaw) · Ry(pitch) · Rx(roll).

Angles → Quaternion

Enter roll (X), pitch (Y) and yaw (Z) in degrees. The resulting quaternion is normalised automatically.

e.g. 45
Decimal point or comma are accepted.
e.g. -30
Angles follow the aerospace roll → pitch → yaw order.
e.g. 120
Intrinsic XYZ sequence (roll → pitch → yaw).

Normalised quaternion

Enter Euler angles in degrees to obtain the quaternion.
w
x
y
z
Axis–angle
Axis undefined (zero rotation).

Rotation matrix

JSON / code to copy

Quaternion → Angles

Enter the quaternion components (w, x, y, z). Non-unit quaternions are normalised before conversion.

e.g. 0.9239
e.g. 0.3827
e.g. 0
e.g. 0

XYZ angles

Enter the quaternion components to recover the angles.
‖q‖
w (normalised)
x (normalised)
y (normalised)
z (normalised)
Axis–angle
Axis undefined (zero rotation).

Rotation matrix

JSON / code to copy

When pitch approaches ±90° the Euler angles become ambiguous (gimbal lock). Check the axis–angle output to interpret the rotation.

Axis–angle → Quaternion

Enter a rotation angle and a 3D axis. The axis is normalised automatically when its length is not 1.

e.g. 90
1 / 0 / 0
0 / 1 / 0
0 / 0 / 1

Normalised quaternion

w
x
y
z

Rotation matrix

JSON / code to copy

Simple 3D preview

The cube orientation updates from the last valid calculation. It is a quick visual aid, not a CAD 3D engine.

The preview updates from the last valid calculation.
What convention does the converter follow?

We use intrinsic XYZ rotations (roll, pitch, yaw) in a right-handed system. Inputs are degrees; outputs provide both degrees and radians plus the rotation matrix.

How are non-unit quaternions handled?

Any non-zero quaternion is normalised before computing the angles. The original norm and normalisation status are displayed in the results.

What is the difference between Euler angles and quaternions?

Euler angles (roll, pitch, yaw) are intuitive to read, but they can suffer from gimbal lock and numerical instability. Quaternions encode 3D rotations without ambiguity, making them more stable for interpolation and control loops.

What is gimbal lock and how do quaternions avoid it?

Gimbal lock happens when two rotational axes align, removing one degree of freedom in an Euler angle representation. Quaternions describe the orientation on a 4D unit sphere, so they keep all three degrees of freedom through any 3D rotation without singularities.

Can I use this calculator with roll, pitch and yaw data from an IMU sensor?

Yes. Enter the IMU roll, pitch and yaw values using the fixed XYZ order in degrees to convert them into normalised quaternions for robotics, drones or game-engine simulations.