Skip to content
Tutorials Center
My learning

Topics

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.

CSS
.arrow {
  rotate: 0.25turn;
}

.sky {
  background: linear-gradient(135deg, #38bdf8, #6366f1);
}

Try it

Four ways to write the same angle

All four squares turn the same amount: one eighth of a full circle. The dark edge shows the direction clockwise.

Syntax

CSS
<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, transform and gradients.
  • Computed value: converted to degrees.
  • Animatable: yes. Angles interpolate as numbers, so 0deg to 720deg makes 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: 45 is invalid. A unitless 0 is accepted only in a few legacy places, so write 0deg anyway. The exception is the hue argument of color functions, where a plain number is read as degrees.
  • Beyond a circle. 450deg is allowed and, in an animation, spins further than 90deg. The final position is the same, the motion is not.
  • Gradient direction. In linear-gradient(), 0deg points up, 90deg right, 180deg down; this differs from the mathematical convention.
  • Trigonometric functions. sin(), cos() and tan() accept angles with units or plain numbers (read as radians).
  • Shortest path. Transitions between rotate values use the numbers you give, so going from 350deg to 10deg turns the long way round.
  • Motion safety. Large or continuous spinning can bother some users; respect prefers-reduced-motion.

Browser support

Supported in every browser.