Triangle Calculator
Triangle area using Heron's formula.
Formula
Heron's: √[s(s-a)(s-b)(s-c)]
Example
Sides 3,4,5 → Area 6.
Embed this calculator on your site
Add this free calculator to your own website with one line of code. The embedded version is responsive, ad-free, and includes a small attribution link back to CalcNest AI.
<iframe src="https://calcnestai.com/embed/triangle-calculator.html" width="100%" height="700" frameborder="0" style="border: 1px solid #e5e5e5; border-radius: 12px; max-width: 720px;" loading="lazy" title="Triangle Calculator — Free Tool by CalcNest AI"></iframe>
Understanding the Triangle Calculator
A triangle calculator checks whether three side lengths form a valid triangle and computes area using Heron's formula. The validity check matters, because three arbitrary lengths frequently cannot close into a triangle at all.
How it actually works
Enter three side lengths. The calculator tests the triangle inequality, then applies Heron's formula using the semi-perimeter. Sides of 3, 4, and 5 give an area of exactly 6 and a perimeter of 12.
| By sides | By angles |
|---|---|
| Equilateral: all equal | Acute: all angles under 90° |
| Isosceles: two equal | Right: one angle exactly 90° |
| Scalene: none equal | Obtuse: one angle over 90° |
| 3-4-5 | Scalene and right |
The deeper context most people miss
The triangle inequality states that any two sides must sum to more than the third, and it holds because the straight path between two points is the shortest. Sides of 1, 2, and 10 cannot close, and the check exists because entering plausible-looking numbers that fail is easy.
Why Heron's formula is useful and slightly treacherous
Heron's formula computes area from the three sides alone, using the semi-perimeter s as half the perimeter and taking the square root of s times each of s minus a side. This is genuinely valuable because side lengths are frequently measurable when heights are not, which is why it appears in surveying and in any situation where a triangle is defined by distances rather than by a base and perpendicular. It dates to Heron of Alexandria in the first century, though evidence suggests Archimedes knew it earlier. Its treachery is numerical: for very thin triangles, where one side is almost the sum of the other two, the terms inside the square root involve subtracting nearly equal quantities, which causes catastrophic cancellation in floating point and can produce wildly inaccurate results or negative values under the root. A numerically stable rearrangement exists, published by Kahan, which sorts the sides and groups the terms to avoid the cancellation, and it is what serious geometric code uses. For hand calculation with exact values the issue does not arise, and for near-degenerate triangles computed in floating point it very much does. The related and cleaner alternatives are one half ab sin C when an angle is known, and the cross product formulation when coordinates are available, which is both simple and numerically well behaved.
A worked example: why 3-4-5 keeps appearing
Sides of 3, 4, and 5 give an area of exactly 6 and a right angle, and this is the smallest Pythagorean triple, meaning three integers satisfying a squared plus b squared equals c squared. Its practical value is that it lets anyone construct a right angle with nothing but a measuring tape, which is why builders use the 3-4-5 method to square foundations, walls, and decks: measure 3 units along one line, 4 along the other, and adjust until the diagonal is exactly 5. Larger multiples including 6-8-10 and 12-16-20 improve accuracy over longer distances, since a proportional error in measurement matters less across a bigger triangle. Egyptian rope stretchers are commonly credited with using knotted ropes for this purpose, though the historical evidence is thinner than the story suggests. Other primitive triples include 5-12-13, 8-15-17, and 7-24-25, and Euclid gave a formula generating all of them. The general result behind this, that a triangle with sides satisfying the Pythagorean relation must contain a right angle, is the converse of Pythagoras's theorem and is what makes the construction valid rather than merely suggestive. Fermat's Last Theorem is the statement that no analogous triples exist for cubes or higher powers, which took 358 years to prove.
Deciding which triangle formula to use
The right approach depends on what is known. Three sides call for Heron's formula, or the numerically stable variant for thin triangles. Two sides and the included angle call for one half ab sin C, which is simpler and better conditioned. A base and perpendicular height call for the standard half base times height. Coordinates call for the shoelace formula or the cross product, both of which are straightforward and stable. For solving unknown sides and angles rather than area, the law of sines relates each side to the sine of its opposite angle and suits cases with two angles and a side, or two sides and a non-included angle, though that last case is ambiguous and can admit two valid triangles, which is a genuine trap known as the ambiguous case. The law of cosines generalises Pythagoras to any triangle and handles three sides or two sides with the included angle, and it is unambiguous. In surveying and navigation, triangulation determines position by measuring angles to known points, and trilateration does the same with distances, which is what GPS uses. In computer graphics, everything reduces to triangles because three points always define a plane, which makes them the fundamental primitive for rendering, and mesh quality is judged partly by avoiding the thin triangles that cause both numerical and visual problems.
Why triangles are structurally special
A triangle is the only polygon that is rigid without additional bracing, because its shape is fully determined by its side lengths, while a quadrilateral with fixed sides can flex into a parallelogram range. This single property explains a great deal of structural engineering: trusses are triangulated because triangles distribute load through tension and compression in the members rather than through bending at the joints, and adding a diagonal to a rectangular frame converts it from a mechanism into a structure. Bridges, roof trusses, cranes, pylons, and geodesic domes all exploit it. The same rigidity makes triangles the basis of finite element meshes and of structural analysis generally. In terms of stability under load, a truss transfers force along member axes, and axial loading is far more efficient than bending, which is why a triangulated structure achieves comparable strength at a fraction of the material. The corollary in practice is that any rectangular frame intended to resist racking needs either a diagonal, a rigid sheet acting as a diaphragm, or moment-resisting joints, which is why sheathing on a timber-framed wall is structural rather than merely a surface. Understanding this makes several building details legible: the plywood on a stud wall, the diagonal brace in a gate, and the cross-bracing in a scaffold are all the same idea.
Variations: special triangles, centres, and coordinate methods
Right triangles support Pythagoras and the basic trigonometric ratios, and the 30-60-90 and 45-45-90 triangles have exact side ratios worth knowing since they appear constantly. Equilateral triangles have area equal to the square of the side times root three over four. Similar triangles have equal angles and proportional sides, which underpins scaling, indirect measurement, and much of classical geometry. Congruent triangles are identical in size and shape, and the standard congruence criteria are side-side-side, side-angle-side, angle-side-angle, and their variants, with side-side-angle notably not being a criterion, which is the same ambiguity that affects the law of sines. Triangle centres form a rich topic: the centroid at the intersection of medians is the centre of mass, the circumcentre is equidistant from the vertices, the incentre is equidistant from the sides, and the orthocentre lies at the intersection of altitudes, with three of them collinear on the Euler line. In coordinates, the shoelace formula gives area directly and the cross product magnitude gives twice the area, both being stable and simple. Spherical and hyperbolic triangles obey different rules, with spherical triangle angles summing to more than 180 degrees, which matters for long-distance navigation.
Working with triangles
Check the triangle inequality before computing anything, since any two sides must sum to more than the third and three arbitrary lengths frequently cannot form a triangle. Use Heron's formula when only the three sides are known, and use the numerically stable Kahan variant for very thin triangles where cancellation destroys accuracy. Use one half ab sin C when two sides and the included angle are known, which is simpler and better conditioned. Use the cross product or shoelace formula when coordinates are available. Use the law of cosines rather than the law of sines when either would work, since the sine case with two sides and a non-included angle is ambiguous and can admit two triangles. Use 3-4-5 or a larger multiple to construct or check a right angle with only a tape measure, taking the largest multiple that fits for better accuracy. Remember that triangles are the only rigid polygon, which is why any rectangular frame resisting racking needs a diagonal, a sheet diaphragm, or moment joints. And avoid thin triangles in meshes and computation, where they cause both numerical and visual problems.
What people get wrong
- Computing an area without checking the triangle inequality, when three plausible-looking lengths frequently cannot close into a triangle at all.
- Using Heron's formula on very thin triangles in floating point, where subtracting nearly equal terms destroys precision and can produce a negative value under the root.
- Applying the law of sines to two sides and a non-included angle, which is the ambiguous case and can admit two valid triangles rather than one.
- Assuming a rectangular frame is rigid, when only triangles are rigid without bracing and a rectangle with fixed sides can rack into a parallelogram.
Where the math comes from
Validity requires the triangle inequality: each pair of sides must sum to more than the third. Area uses Heron's formula, with semi-perimeter s = (a+b+c)/2 and Area = √(s(s−a)(s−b)(s−c)). For thin triangles this loses precision in floating point, and a stable rearrangement sorting the sides is preferred in computation.
Questions and answers
Diameter vs radius?
Diameter is the distance across; radius is half of diameter. Different formulas use different ones - read carefully which the calculator expects.
How precise should I use pi?
For everyday problems, 3.14 is fine. For engineering, use pi = 3.14159 or more decimal places. The calculator typically uses many decimal places internally.
Why do my measurements not match the formula?
Real objects have manufacturing tolerances, irregular shapes, and measurement error. Treat geometric calculations as ideals; physical reality often deviates 1-5%.
Surface area or volume?
Surface area is 2D (square units); volume is 3D (cubic units). Different formulas, different units. Mismatching is a common error.
How do I handle compound shapes?
Break into measurable simpler shapes (rectangles, triangles, circles), calculate each, and add. Subtract any holes or removed sections.
Why do some side lengths not form a triangle?
Because of the triangle inequality: any two sides must sum to more than the third, since the straight path between two points is the shortest. Sides of 1, 2, and 10 cannot close, as the two short sides can never reach across the long one.
What is Heron's formula for?
Computing area from the three side lengths alone, without needing a height or an angle. That suits surveying and any situation where distances are measurable but perpendicular heights are not, which is why it remains genuinely useful rather than a curiosity.
Is Heron's formula always reliable?
Not in floating point for very thin triangles, where the terms involve subtracting nearly equal quantities and precision collapses, sometimes producing a negative value under the square root. A stable rearrangement by Kahan sorts the sides to avoid this.
Why do builders use 3-4-5?
Because it's the smallest Pythagorean triple, so a triangle with those proportions contains an exact right angle. Measuring 3 along one line and 4 along the other and adjusting until the diagonal is 5 squares a corner with nothing but a tape measure.
Why are triangles used in structures?
Because they're the only polygon rigid without bracing: side lengths fully determine the shape, while a quadrilateral with fixed sides can flex. That's why trusses are triangulated and why a diagonal converts a rectangular frame from a mechanism into a structure.
When is the law of sines ambiguous?
With two sides and a non-included angle, where two different triangles can satisfy the same measurements. The law of cosines is unambiguous and is preferable whenever either would work, which avoids the problem entirely.
How do I find the area from coordinates?
The shoelace formula or, equivalently, half the magnitude of the cross product of two edge vectors. Both are simple and numerically well behaved, and they handle any orientation without needing to identify a base or height.
Related calculators
Pi Day · Square Root · Trapezoid Area · Cylinder Volume · Geometric Series