CSS Reference ยท Units and Values
The deg, rad, grad and turn units
Reference for CSS angle units deg, grad, rad and turn: how they convert, where angles are used in transforms, gradients and color, with live examples.
CSS measures angles in four units: degrees (deg), gradians (grad), radians (rad) and turns (turn). They describe the same thing in different scales, and you can use any of them wherever an <angle> is accepted: rotate, transform, linear-gradient(), conic-gradient(), hue-rotate(), offset-rotate and so on.
A full circle is 360deg, 400grad, about 6.2832rad (which is 2ฯ) or exactly 1turn. Degrees are the most readable, and turn is handy for fractions of a rotation, such as 0.25turn for a quarter.
.arrow { rotate: 0.25turn; } .sky { background: linear-gradient(135deg, #38bdf8, #6366f1); }
Try it
All four squares turn the same amount: one eighth of a full circle. The dark edge shows the direction clockwise.
Syntax
<angle> = <number>deg | <number>grad | <number>rad | <number>turn
- Applies to: any property or function that accepts an
<angle>. - Direction: positive angles go clockwise in
rotate,transformand gradients. - Computed value: converted to degrees.
- Animatable: yes. Angles interpolate as numbers, so
0degto720degmakes two spins.
Values
| Unit | Full circle | Quarter turn |
|---|---|---|
deg |
360deg | 90deg |
grad |
400grad | 100grad |
rad |
2ฯ rad, about 6.2832rad | ฯ/2 rad, about 1.5708rad |
turn |
1turn | 0.25turn |
Usage notes
- Always write the unit.
rotate: 45is invalid. A unitless0is accepted only in a few legacy places, so write0deganyway. The exception is the hue argument of color functions, where a plain number is read as degrees. - Beyond a circle.
450degis allowed and, in an animation, spins further than90deg. The final position is the same, the motion is not. - Gradient direction. In
linear-gradient(),0degpoints up,90degright,180degdown; this differs from the mathematical convention. - Trigonometric functions.
sin(),cos()andtan()accept angles with units or plain numbers (read as radians). - Shortest path. Transitions between
rotatevalues use the numbers you give, so going from350degto10degturns the long way round. - Motion safety. Large or continuous spinning can bother some users; respect
prefers-reduced-motion.
Browser support
Supported in every browser.