# sin()

> The `sin()` CSS math function returns the sine of a number, in radians.

## How do I use sin() in CSS for circular layouts?

The math function that returns the sine of an angle, typically used within `calc()` to perform trigonometric calculations. This function can help create advanced geometrical effects or animations based on sinusoidal wave patterns.

- Topic: Mathematics
- Type: function
- Browser support: Chrome 111+, Chrome Android 111+, Edge 111+, Firefox 108+, Firefox Android 108+, Safari 15.4+, Safari iOS 15.4+

## Example

Wrong:

```css
.dot {
  top: calc(sin(30) * 100px);
}
```

Right:

```css
.dot {
  top: calc(sin(30deg) * 100px);
}
```

A plain number is read as radians, so the 'deg' unit is needed to get the sine of 30 degrees, which is half.

## Common mistakes

- Writing `sin(30)` and getting the sine of 30 radians, not degrees.
- Using `sin()` as a length, which makes the declaration invalid.

## Key points

- The angle argument has a unit like 'deg' or 'turn' unless radians are meant.
- The result is multiplied by a length inside `calc()` before it is used as a position.
- A fallback value comes first where trigonometric functions are unsupported.

## Interview questions

### Can I animate sin() in CSS?

Yes. Register the angle custom property with `@property` as an `<angle>`, then animate it, and `sin()` updates each frame.

### What is the difference between sin() and asin()?

`sin()` takes an angle and returns a number from -1 to 1. `asin()` takes such a number and returns the angle.

## Related cards

- [cos()](https://wonderium.dev/css/cos.md)
- [asin()](https://wonderium.dev/css/asin.md)
- [@property](https://wonderium.dev/css/property.md)
- [calc()](https://wonderium.dev/css/calc.md)
- [Math.sin()](https://wonderium.dev/js/math-sin.md)

---

- Level: [CSS](https://wonderium.dev/css.md)
- HTML version: https://wonderium.dev/css/sin
- Last updated: 2026-11-25
