Triangle Calculator
Solve any triangle from 3 sides (SSS), 2 sides and an angle (SAS), or 2 angles and a side (ASA). Shows area, perimeter, heights, and a diagram.
A triangle calculator solves for every unknown side, angle, area, perimeter, and altitude from partial information. Enter three sides (SSS), two sides and the included angle (SAS), or two angles and the included side (ASA). The calculator applies the Law of Cosines, the Law of Sines, and Heron's formula as needed, draws a scaled SVG diagram, and shows each step.
About Triangle Calculator
How Each Mode Works
Each mode picks the shortest formula chain that uniquely determines the triangle from your inputs. SSS uses the Law of Cosines then Heron's formula, SAS uses the Law of Cosines then reduces to SSS, and ASA uses the angle sum rule with the Law of Sines.
| Mode | You Know | Method Used | Example Input |
|---|---|---|---|
| SSS | All three sides | Law of Cosines for angles, Heron's formula for area | a=5, b=7, c=9 |
| SAS | Two sides and included angle | Law of Cosines for third side, then SSS | a=5, b=7, C=60° |
| ASA | Two angles and included side | Third angle = 180° - A - B, Law of Sines for sides | A=40°, B=70°, c=8 |
Triangle Formulas Reference
Law of Cosines: c² = a² + b² - 2ab cos(C)
Used when you know SSS (to find angles) or SAS (to find the third side). It generalizes the Pythagorean theorem - when C = 90°, the cos(C) term disappears and you get a² + b² = c².
Law of Sines: a/sin(A) = b/sin(B) = c/sin(C)
Used when you know ASA or AAS. Each side is proportional to the sine of its opposite angle.
Heron's formula (area from three sides):
s = (a + b + c) / 2
A = √(s(s-a)(s-b)(s-c))
SAS area formula: A = (1/2) x a x b x sin(C)
Heights: h_a = 2A / a, h_b = 2A / b, h_c = 2A / c
Worked Examples
SSS: a = 5, b = 7, c = 9
- Find angle C: cos(C) = (5² + 7² - 9²) / (2 x 5 x 7) = (25 + 49 - 81) / 70 = -7/70 = -0.1
- C = arccos(-0.1) = 95.74°
- Heron's formula: s = (5 + 7 + 9) / 2 = 10.5
- Area = √(10.5 x 5.5 x 3.5 x 1.5) = √303.1875 = 17.41
- Perimeter = 21
SAS: a = 6, b = 8, C = 50°
- Find c: c² = 36 + 64 - 2(6)(8)cos(50°) = 100 - 96(0.6428) = 100 - 61.71 = 38.29
- c = √38.29 = 6.19
- Area = (1/2)(6)(8)sin(50°) = 24(0.766) = 18.39
Triangle Classification
| By Sides | Definition | Properties |
|---|---|---|
| Equilateral | All three sides equal | All angles 60°, maximum area for given perimeter |
| Isosceles | Two sides equal | Two equal angles opposite the equal sides |
| Scalene | No equal sides | All angles different |
| By Angles | Definition | Properties |
|---|---|---|
| Acute | All angles less than 90° | All altitudes fall inside the triangle |
| Right | One angle equals 90° | Pythagorean theorem applies |
| Obtuse | One angle greater than 90° | One altitude falls outside the triangle |
The Triangle Inequality
Three lengths can form a triangle only if the sum of any two sides is greater than the third. Formally: a + b > c, a + c > b, and b + c > a. If any of these fail, the triangle is impossible. The calculator validates your inputs and warns you if they do not form a valid triangle.
Valid: 3, 4, 5 (3+4=7 > 5, 3+5=8 > 4, 4+5=9 > 3)
Invalid: 1, 2, 5 (1+2=3 < 5 - these cannot form a triangle)
Practical Applications
- Construction: Calculating roof angles, rafter lengths, and triangular structural supports
- Surveying: Triangulation uses known distances and angles to determine unknown positions
- Navigation: Finding distances and bearings between three points
- Design: Calculating material needed for triangular shapes (sails, banners, architectural features)
For right triangles specifically, the Pythagorean theorem calculator provides a focused tool. For deeper trigonometry work, the law of cosines calculator and law of sines calculator show detailed workings for each formula.
What About AAS, SSA, and the Ambiguous Case?
AAS (two angles and a non-included side) is uniquely solvable and reduces to ASA by using the angle sum 180° - A - B to find the third angle. SSA (two sides and an angle not between them) is the ambiguous case and can have zero, one, or two valid triangles depending on the numbers. This calculator covers SSS, SAS, and ASA because those three always produce a single unique triangle. If you have an SSA setup, the Law of Sines calculator walks through the full ambiguous case logic and flags both solutions when they exist.
| Given | Shorthand | Unique? | Method |
|---|---|---|---|
| 3 sides | SSS | Yes | Law of Cosines for angles, Heron for area |
| 2 sides + included angle | SAS | Yes | Law of Cosines for 3rd side, then SSS |
| 2 angles + included side | ASA | Yes | 180° rule + Law of Sines |
| 2 angles + non-included side | AAS | Yes | Same as ASA after finding 3rd angle |
| 2 sides + non-included angle | SSA | No (0, 1, or 2) | Ambiguous case - Law of Sines with test |
| 3 angles | AAA | No (infinite) | Shape known, size not fixed |
How Accurate Are the Results?
The calculator uses double-precision IEEE 754 floats - about 15-17 significant decimal digits - which is well beyond any practical measurement accuracy. The bigger source of error is rounding in the inputs. If you round a surveyed distance to one decimal place, that roughly 0.5% input error propagates through the Law of Cosines and produces about 0.5-1% error on angles and 1% on derived sides. For engineering or land-surveying work, the Federal Highway Administration's Surveying and Mapping Manual recommends carrying at least one more decimal place than the target output precision, then rounding only at the end. Displayed values are truncated to four decimal places for readability, but internal calculations keep full precision.
Worked check: for the SSS example a=5, b=7, c=9, the angle sum A+B+C should equal exactly 180°. Running it through: A ≈ 33.56°, B ≈ 50.70°, C ≈ 95.74°, sum = 180.00°. Any deviation beyond rounding is a bug or an invalid input.
Where Triangle Solving Shows Up in the Real World
Triangulation is one of the oldest measurement techniques in civil engineering, still built into modern GPS and laser rangefinders. The UK Ordnance Survey Retriangulation of Great Britain (1935-1962) covered the whole country with concrete trig pillars at known positions, and surveyors used Law of Cosines calculations to fix every map grid reference still in use today. Acoustic localisation (bat echolocation studies, microphone array systems) solves SSS triangles every millisecond. Robotics inverse kinematics uses SAS and ASA to work out joint angles for a target end-effector position. Even CSS transforms in browser layout engines resolve to the same set of triangle equations when calculating rotation and skew.
- Construction: Roof pitch, rafter lengths, and truss design almost always use SAS (known run and rise with the apex angle) or SSS (measured sides).
- Surveying: Traversing and trilateration mix SSS and SAS to fix unknown positions from baseline measurements.
- Navigation: Marine and aviation bearings use ASA and AAS to convert fix-to-fix angles and a known leg into the full track.
- Astronomy: Parallax distance calculations are ASA problems using the Earth's orbital baseline and two observed angles to a star.
- 3D graphics: Normal vector calculations for lighting rely on triangle area via the cross product, which matches (1/2) × a × b × sin(C).
Common Mistakes
- Degrees vs radians: Most calculators default to radians. This tool uses degrees throughout. If you are cross-checking against a scientific calculator, set it to DEG mode.
- Rounding angles before summing: Rounding each angle to 1 decimal place can make the three angles not quite add to 180°. Keep full precision internally.
- Wrong side-angle pairing: Side a is always opposite vertex A, not next to it. Labelling the wrong way breaks the Law of Sines and the Law of Cosines.
- Trying SSA in SAS mode: SAS needs the angle between the two sides. If your known angle is opposite one of the sides, use the Law of Sines calculator for the ambiguous case instead.
- Mixing units: Sides must share one unit (cm, m, ft, in - the tool is unit-agnostic). Feeding side a in cm and side b in m gives nonsense.
- Treating heights as sides: The altitude ha is a perpendicular line from vertex A to side a, not the length of the triangle's side. It can be longer than any side in narrow obtuse triangles.
Historical Context
Trigonometry as a discipline traces back to Hipparchus of Nicaea around 150 BC, who built the first chord table - the Greek equivalent of a sine table. The Law of Cosines appears in Book II of Euclid's Elements (circa 300 BC) as Propositions 12 and 13, written geometrically before the language of cosine existed. The Law of Sines is usually credited to the 10th-century Persian astronomer Abu al-Wafa and was stated in its modern form by Nasir al-Din al-Tusi in the 13th century's Treatise on the Quadrilateral, the first work to treat trigonometry as a subject independent of astronomy. Heron of Alexandria published his area formula in Metrica around 60 AD, though Archimedes knew it two centuries earlier. The modern notation (a, b, c for sides opposite A, B, C) was standardised by Leonhard Euler in the 18th century. Every step this calculator performs relies on results that have been stable for between 300 and 2,300 years.
All calculations happen in your browser with no data sent anywhere.
Sources
- Wolfram MathWorld - Law of Cosines
- Wolfram MathWorld - Law of Sines
- Wolfram MathWorld - Heron's Formula
- NIST Digital Library of Mathematical Functions - Trigonometric Identities
- Ordnance Survey - A Guide to Coordinate Systems in Great Britain
- FHWA - Geotechnical Engineering Surveying Methods
- Britannica - History of Trigonometry
Frequently Asked Questions
What is SSS, SAS, and ASA?
These describe what information you know about a triangle. SSS means you know all three sides. SAS means you know two sides and the angle between them. ASA means you know two angles and the side between them.
How does the calculator find the area?
For SSS mode, it uses Heron's formula which only needs the three side lengths. For SAS mode, it uses the formula Area = (1/2) times a times b times sin(C). For ASA, it first finds all sides using the law of sines, then calculates the area.
What makes a triangle invalid?
A triangle is invalid if the sum of any two sides is less than or equal to the third side. For example, sides 1, 2, and 5 cannot form a triangle because 1 + 2 is less than 5. The calculator will warn you if this happens.
What are the heights of a triangle?
The height (or altitude) from a side is the perpendicular distance from that side to the opposite vertex. The calculator finds all three heights using the formula h = 2 times area divided by the base length.
Can I solve a right triangle with this tool?
Yes. Enter the sides in SSS mode or use SAS with a 90-degree angle. For a dedicated right triangle tool, check out the Pythagorean Theorem Calculator.
Related Tools
Link to this tool
Copy this HTML to link to this tool from your website or blog.
<a href="https://toolboxkit.io/tools/triangle-calculator/" title="Triangle Calculator - Free Online Tool">Try Triangle Calculator on ToolboxKit.io</a>