Favorites

asin() CSS Function

asin()
CSS FunctionThis function is supported by all modern browsers.
Updated 21st November 2026

The asin() function returns the arcsine of a number between -1 and 1, as an angle.

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee

Description

The asin() CSS function calculates the arcsine (inverse sine) of a number. It answers the question "which angle has this sine?". The argument is a <number> between -1 and 1, and the result is an <angle> between -90deg and 90deg. For example, asin(0.5) is 30deg and asin(1) is 90deg. Values outside the range -1 to 1 return NaN.

Because the result is an angle, it can be used directly in rotations. A typical use is turning a ratio into a tilt, for example rotating a needle or a progress indicator according to a value stored in a custom property.

The asin() 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.

/* Rotate by the angle whose sine is 0.5 (30deg) */
.needle {
  rotate: asin(0.5);
}

/* Tilt based on a ratio between -1 and 1 */
.gauge {
  rotate: asin(var(--ratio));
}

Interactive Demo

Demo Code
HTML Code
<div class="demo-dial">
	<div class="demo-element"></div>
</div>
CSS Code
.demo-dial {
	position: relative;
	width: 200px;
	height: 200px;
	border-radius: 50%;
	background: repeating-conic-gradient(from 90deg, #b0b0b0 0 1deg, transparent 1deg 15deg), #f4f4f4;
	outline: 1px solid #c5c5c5;
}
.demo-dial::after {
	content: "";
	position: absolute;
	left: 100px;
	top: 100px;
	width: 100px;
	border-top: 1px dashed #4361ee;
}
.demo-element {
	position: absolute;
	left: 100px;
	top: 98px;
	width: 95px;
	height: 4px;
	border-radius: 2px;
	background: #f72585;
	transform-origin: 0 50%;
	rotate: asin(0);
}

Syntax

asin() = asin( <calc-sum> )

Values

  • <calc-sum>A calculation resolving to a <number> between -1 and 1. The function returns an <angle> between -90deg and 90deg.

Example

<div class="wrap">
<h1>CSS asin() examples</h1>
<div class="grid">
<div class="card">
<div class="dial"><span class="needle" style="--v: 0"></span></div>
<div class="label">asin(0) = 0deg</div>
</div>
<div class="card">
<div class="dial"><span class="needle" style="--v: 0.5"></span></div>
<div class="label">asin(0.5) = 30deg</div>
</div>
<div class="card">
<div class="dial"><span class="needle" style="--v: 0.866"></span></div>
<div class="label">asin(0.866) &asymp; 60deg</div>
</div>
<div class="card">
<div class="dial"><span class="needle" style="--v: 1"></span></div>
<div class="label">asin(1) = 90deg</div>
</div>
</div>
<p class="note">Needles are rotated counter-clockwise by the angle asin() returns.</p>
</div>
/* Base demo layout */
* { box-sizing: border-box; }

body {
margin: 24px;
font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
background: #f5f7fb;
color: #102a43;
}

.wrap {
max-width: 860px;
margin: 0 auto;
}

h1 {
font-size: 20px;
margin: 0 0 16px;
}

.grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
gap: 16px;
}

.card {
background: #fff;
border-radius: 12px;
padding: 16px;
box-shadow: 0 6px 18px rgba(16, 42, 67, 0.08);
}

.label {
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
font-size: 12px;
color: #486581;
margin-top: 10px;
word-break: break-word;
}

.note {
font-size: 13px;
color: #486581;
margin-top: 14px;
}

/* asin() examples */
.dial {
position: relative;
width: 120px;
height: 120px;
margin: 0 auto;
border-radius: 50%;
background: #e2e8f0;
}

.needle {
position: absolute;
left: 50%;
top: 50%;
width: 52px;
height: 4px;
margin-top: -2px;
border-radius: 2px;
background: #dc2626;
transform-origin: left center;
}

.dial::after {
content: '';
position: absolute;
left: 50%;
top: 50%;
width: 10px;
height: 10px;
margin: -5px 0 0 -5px;
border-radius: 50%;
background: #0f172a;
}

.needle { rotate: calc(asin(var(--v)) * -1); }
Open in editor

Browser Support

The following information will show you the current browser support for the CSS asin() function. Hover over a browser icon to see the version that first introduced support for this CSS function.

This function is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee