Math Runs locally Ready to use Built-in examples No tracking

Trigonometry Calculator

Compute sine, cosine and tangent of any angle, or invert them with asin, acos and atan. Supports degrees and radians with undefined-point detection.

Trigonometry is the shared language of geometry and of anything that oscillates, but a few moments still catch people out: why tan 90° has no value, whether sin 30° is exactly 0.5, and why an inverse trig answer seems to be missing half the circle. Degrees and radians switch freely here, and undefined points are reported rather than computed to an enormous number.

Degrees and radians are not interchangeable: sin(30°) = 0.5, but Math.sin(30) in code is the sine of 30 radians (≈ sin 1718.87°). Inverse functions return principal values — asin lies in [−90°, 90°] and acos in [0°, 180°] — so a second-quadrant angle comes back as its reflection, and you have to apply π − result yourself. The special angles are given exactly rather than as rounded decimals.

How to use

  1. Choose degrees or radians.
  2. Enter the angle and read sin, cos and tan.
  3. For an inverse function, enter the ratio and note the principal-value range.
  4. Copy the result; adjust second-quadrant angles by hand when you need them.

How it works

Choosing between sin, cos and tan

Pick the function: sin is opposite over hypotenuse, cos is adjacent over hypotenuse, tan is opposite over adjacent. Enter 30 to get sin30° = 0.5.

Degrees vs. radians

Units are switchable: degrees (°) are the default; radians (rad) dominate higher mathematics. π/6 rad = 30°.

Inverse functions to find angles

Inverse functions recover angles: given sinθ = 0.5, choose asin and enter 0.5 to get θ = 30°. asin/acos inputs must lie between −1 and 1.

Code example

JavaScript Degree conversion and special angles

const rad = (deg) => deg * Math.PI / 180;

const sin = (deg) => Math.sin(rad(deg));
const cos = (deg) => Math.cos(rad(deg));
const tan = (deg) =>
  Math.abs(deg % 180) === 90 ? NaN : Math.tan(rad(deg));

sin(30);    // 0.49999999999999994 (floating point, ≈ 0.5)
tan(90);    // NaN (undefined, flagged explicitly)
Math.asin(0.5) * 180 / Math.PI;   // 30 (inverse trig returns radians)

Python math and cmath

import math

math.sin(math.radians(30))   # 0.49999999999999994
math.tan(math.radians(90))   # 1.633e16 (garbage! intercept it yourself)

# Inverse trig returns radians:
math.degrees(math.asin(0.5))   # 30.0

# Python's tan(90°) does not raise, it just returns a huge number,
# so careful code must test the undefined points first

FAQ

Why can't tan 90° be computed?

At 90° the cosine is 0, and tangent = sin ÷ cos divides by zero — mathematically undefined. The calculator reports out of domain rather than inventing some enormous number.

Why is sin 180° shown as 0 instead of a string of decimals?

Computers work in radians internally, and 180° in radians carries tiny representation error. This tool snaps any result with absolute value below 10⁻¹² to a clean 0.

Are decimal degrees allowed?

Yes. sin(12.5°) ≈ 0.2164 works fine, and negative angles like −30° are accepted too.

How are the trig functions defined in a right triangle?

sin = opposite ÷ hypotenuse, cos = adjacent ÷ hypotenuse, tan = opposite ÷ adjacent. From these follow tan = sin ÷ cos and sin²θ + cos²θ = 1. With one ratio plus a known side, all remaining sides are solvable.

What are the ranges of the inverse functions?

arcsin returns values in [−90°, 90°], arccos in [0°, 180°], arctan in (−90°, 90°). You always get the principal value; if the true angle lies outside that range, adjust by ±180° using the quadrant of your diagram.

What are the values at special angles?

30°: sin = 0.5, cos = √3/2 ≈ 0.866, tan = √3/3 ≈ 0.577; 45°: √2/2 ≈ 0.707, √2/2 ≈ 0.707, 1; 60°: √3/2 ≈ 0.866, 0.5, √3 ≈ 1.732. Memorize these three sets and most exams and engineering estimates are covered.

Why does sin 30° sometimes show 0.4999 instead of 0.5?

The degree is first converted to radians (30° = π/6 ≈ 0.5236), and π being irrational means the approximation carries a tiny error. With enough significant digits the value rounds to 0.5 — normal behavior, not a bug.