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.
Normalised quaternion
Rotation matrix
JSON / code to copy
Quaternion → Angles
Enter the quaternion components (w, x, y, z). Non-unit quaternions are normalised before conversion.
XYZ angles
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.
Normalised quaternion
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.
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.
Improve this calculator
Found an error or missing a feature?
Send us the example so we can review this calculator and turn real cases into improvements or automated tests.