acos() CSS Function
The acos() function returns the arccosine of a number between -1 and 1, as an angle.
Description
The acos() CSS function calculates the arccosine (inverse cosine) of a number. It returns the angle whose cosine is the given value. The argument is a <number> between -1 and 1, and the result is an <angle> between 0deg and 180deg. For example, acos(1) is 0deg, acos(0) is 90deg and acos(-1) is 180deg. Values outside -1 to 1 return NaN.
Because acos() maps the range -1 to 1 onto a half circle, it is useful for semicircular gauges and meters: a value of 1 points one way, -1 points the opposite way, and everything in between is spread across the arc.
The acos() function is one of the CSS trigonometric functions, together with sin(), cos(), tan(), asin(), acos(), atan() and atan2(). Like calc(), it can be used anywhere a value of the matching type is accepted, and its arguments can contain full calculations, custom properties and the constants pi and e.
/* acos(0.5) = 60deg */
.hand {
rotate: acos(0.5);
}
/* A half-circle gauge driven by a value from -1 to 1 */
.meter .needle {
rotate: calc(acos(var(--value)) * -1);
}
Interactive Demo
Syntax
acos() = acos( <calc-sum> )
Values
- <calc-sum>A calculation resolving to a <number> between -1 and 1. The function returns an <angle> between 0deg and 180deg.
Example
Browser Support
The following information will show you the current browser support for the CSS acos() function. Hover over a browser icon to see the version that first introduced support for this CSS function.
Desktop





Tablets & Mobile





