sin() CSS Function
The sin() function returns the sine of an angle, a number between -1 and 1, useful for circular layouts and wave effects.
Description
The sin() CSS function calculates the sine of an angle. The argument is an <angle>, such as 30deg or 0.25turn, or a plain number, which is treated as radians. The result is a <number> between -1 and 1. For example, sin(30deg) is 0.5 and sin(90deg) is 1.
In layout, sine gives the vertical position of a point on a circle, and it produces smooth wave patterns. Multiply the result by a length to turn it into a distance: calc(sin(45deg) * 100px) is about 70.7px. Together with cos(), it lets you place items around a circle or along a curve purely in CSS.
The sin() 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.
/* Place dots on a sine wave using an index */
.dot {
translate: 0 calc(sin(var(--i) * 30deg) * 40px);
}
/* Vertical position on a circle of radius 100px */
.item {
top: calc(50% + sin(var(--angle)) * 100px);
}
Interactive Demo
Syntax
sin() = sin( <calc-sum> )
Values
- <calc-sum>A calculation resolving to an <angle> or a <number> (interpreted as radians). The function returns a <number> from -1 to 1.
Example
Browser Support
The following information will show you the current browser support for the CSS sin() function. Hover over a browser icon to see the version that first introduced support for this CSS function.
Desktop





Tablets & Mobile





