Coordinate Rotation Calculator – Rotate Points in 2D and 3D
Rotating a point is one of the most common transformations in computer graphics, robotics, engineering, and coordinate geometry. Whenever a sprite spins on screen, a robotic arm sweeps through an angle, or a CAD drawing gets reoriented, the underlying math is the same: a rotation matrix applied to a set of coordinates. This calculator computes the new position of a point after rotating it by any angle around the origin, a custom pivot, or one of the three axes in 3D space.
The 2D Rotation Formula
To rotate a point (x, y) by angle θ around the origin (0, 0), the standard rotation matrix gives:
x' = x·cos(θ) − y·sin(θ)y' = x·sin(θ) + y·cos(θ)
For example, rotating the point (3, 4) by 90° givesx' = 3·cos(90°) − 4·sin(90°) = −4 andy' = 3·sin(90°) + 4·cos(90°) = 3, so the rotated point is(−4, 3).
Rotating Around a Custom Pivot
When rotating around a point other than the origin — a pivot (cx, cy) — the calculation happens in three stages: translate the point so the pivot sits at the origin, apply the standard rotation, then translate back:
x' = cx + (x − cx)·cos(θ) − (y − cy)·sin(θ)y' = cy + (x − cx)·sin(θ) + (y − cy)·cos(θ)
This translate-rotate-translate-back sequence is exactly what the step-by-step accordion in the calculator shows, making it easy to follow how each intermediate value is derived.
3D Rotation About the X, Y, and Z Axes
In three dimensions, a rotation happens around one of the coordinate axes, and each axis has its own 3×3 rotation matrix. Rotating around the Z-axis behaves like a 2D rotation in the XY-plane while Z stays fixed; rotating around the X-axisrotates the YZ-plane, and rotating around the Y-axis rotates the XZ-plane. For instance, rotating (0, 1, 0) by 90° about the X-axis produces (0, 0, 1), since the rotation swings the Y-component into the Z-component.
Degrees, Radians, and Unit Conversion
Angles can be entered in either degrees or radians. Internally, every calculation converts the angle to radians before calling Math.cos and Math.sin, using:
rad = deg × (π / 180) and deg = rad × (180 / π)
The calculator always displays the angle in both units so you can cross-check your input and results regardless of which convention your project uses.
Displacement and the Rotation Matrix
Alongside the new coordinates, the tool reports the displacement — the straight-line distance between the original and rotated point — and displays the full rotation matrix used in the calculation. Seeing the matrix explicitly is useful for verifying hand calculations, debugging a graphics transform pipeline, or understanding how rotation matrices compose with translation and scaling in a broader transformation stack.
1.2e-16 instead of an exact 0 due to floating-point rounding. Any result within 1e-10 of zero is automatically snapped to 0 for a cleaner display.Common Applications
- Computer graphics and game development — rotating sprites, meshes, or camera orientations frame by frame
- Robotics — computing joint and end-effector positions as a robotic arm sweeps through an angle
- CAD and engineering design — reorienting parts, drawings, or assemblies around a reference point
- Physics simulations — modeling rotational motion of objects or reference frames
- Mathematics education — visualizing how coordinate geometry transformations work step by step
Batch Rotation of Multiple Points
Many real problems require rotating several points together — the vertices of a triangle, the corners of a bounding box, or a full polygon outline — using the same angle and center so the shape rotates as a rigid body. Applying the same formula to each vertex individually preserves the shape's size and internal angles while only changing its orientation.