Calculate Sine, Cosine, Tangent and reciprocal ratios using angles or triangle sides.
1. Calculate by Angle
2. Calculate by Sides (Right Triangle)
Results
Sine (sin)
–
Cosine (cos)
–
Tangent (tan)
–
Cosecant (csc)
–
Secant (sec)
–
Cotangent (cot)
–
Understanding Trigonometric Ratios
Trigonometric ratios are mathematical values that describe the relationship between the angles and sides of a right-angled triangle. These ratios are fundamental to geometry, physics, engineering, and navigation.
The Core Trigonometric Ratios (SOH CAH TOA)
The acronym SOH CAH TOA is the easiest way to remember the primary ratios:
Sine (sin θ): Opposite / Hypotenuse (SOH)
Cosine (cos θ): Adjacent / Hypotenuse (CAH)
Tangent (tan θ): Opposite / Adjacent (TOA)
Reciprocal Ratios
In addition to the primary three, there are three reciprocal ratios:
Cosecant (csc θ): 1 / Sine
Secant (sec θ): 1 / Cosine
Cotangent (cot θ): 1 / Tangent
How to Use This Calculator
This tool allows you to find trigonometric values in two ways:
By Angle: Enter the degree of an angle to find all six trigonometric ratios instantly. For example, entering 30° will show that the Sine is 0.5.
By Sides: Enter the lengths of the "Opposite" and "Adjacent" sides of a right triangle. The calculator will use the Pythagorean theorem (a² + b² = c²) to find the hypotenuse and then solve for all ratios.
Example Calculation
If you have a right triangle where the opposite side is 3 units and the adjacent side is 4 units:
Hypotenuse: √(3² + 4²) = √25 = 5
Sine: 3/5 = 0.6
Cosine: 4/5 = 0.8
Tangent: 3/4 = 0.75
function calculateByAngle() {
var angleDeg = document.getElementById('inputAngle').value;
var display = document.getElementById('trigResultsArea');
var sideInfo = document.getElementById('sideInfo');
if (angleDeg === "" || isNaN(angleDeg)) {
alert("Please enter a valid angle in degrees.");
return;
}
var angleRad = angleDeg * (Math.PI / 180);
var sinVal = Math.sin(angleRad);
var cosVal = Math.cos(angleRad);
var tanVal = Math.tan(angleRad);
updateDisplay(sinVal, cosVal, tanVal);
document.getElementById('resultTitle').innerText = "Results for " + angleDeg + "°";
sideInfo.innerText = "";
display.style.display = "block";
}
function calculateBySides() {
var opp = parseFloat(document.getElementById('sideOpposite').value);
var adj = parseFloat(document.getElementById('sideAdjacent').value);
var display = document.getElementById('trigResultsArea');
var sideInfo = document.getElementById('sideInfo');
if (isNaN(opp) || isNaN(adj) || opp <= 0 || adj <= 0) {
alert("Please enter positive numerical values for both sides.");
return;
}
var hyp = Math.sqrt(Math.pow(opp, 2) + Math.pow(adj, 2));
var angleRad = Math.atan2(opp, adj);
var angleDeg = angleRad * (180 / Math.PI);
var sinVal = opp / hyp;
var cosVal = adj / hyp;
var tanVal = opp / adj;
updateDisplay(sinVal, cosVal, tanVal);
document.getElementById('resultTitle').innerText = "Results from Sides (" + opp + ", " + adj + ")";
sideInfo.innerText = "Calculated Hypotenuse: " + hyp.toFixed(4) + " | Calculated Angle: " + angleDeg.toFixed(2) + "°";
display.style.display = "block";
}
function updateDisplay(s, c, t) {
// Handle division by zero or infinity for ratios
var format = function(val) {
if (!isFinite(val)) return "Undefined";
if (Math.abs(val) < 0.0000000001) return "0";
return Number(val.toFixed(6)).toString();
};
document.getElementById('resSin').innerText = format(s);
document.getElementById('resCos').innerText = format(c);
document.getElementById('resTan').innerText = format(t);
document.getElementById('resCsc').innerText = format(1 / s);
document.getElementById('resSec').innerText = format(1 / c);
document.getElementById('resCot').innerText = format(1 / t);
}