Math calculator

Heron’s Formula Calculator

Area from three sides — no angle, no height.

Area from three sides

No angle and no height needed.

s = 6

6

√(s(s−a)(s−b)(s−c)), computed in the rearrangement that does not lose precision.

Area

6

stable form

Textbook form gives

6

agreeing to the last digit

Semiperimeter s

6

half the perimeter

Inradius

1

area ÷ s

Height to a

4

2 × area ÷ a

Circumradius

2.5

abc ÷ 4×area

  • Semiperimeter s = (a + b + c) ÷ 2 = 6.000000000. Heron's formula is √(s(s−a)(s−b)(s−c)), and it needs no angle at all — three lengths are enough.
  • Both the textbook form and the numerically stable rearrangement agree here to the last digit. They part company on needle-shaped triangles, where the naive version can lose almost every significant figure.
  • The three heights follow immediately, since the area is half of base times height for each side in turn.

Kahan’s rearrangement throughout, with the textbook form shown beside it rather than instead of it.

What this tool shows

Three lengths are enough for an area: √(s(s−a)(s−b)(s−c)), where s is half the perimeter. But the order of that arithmetic matters — written the textbook way it loses most of its digits on a long thin triangle, and this page uses the form that does not.

  • The area of a triangle from three sides
  • The semiperimeter it is built on
  • What the textbook form returns on the same numbers
  • The height to each side
  • The inradius and circumradius
  • Degenerate cases, where the area is exactly zero
No angle needed Stable rearrangement The naive form beside it Heights and radii too

Kahan’s stable form; the textbook one is shown for contrast.

Updated 7 September 2026 · Works in any browser, no installation

Halve the perimeter, then multiply s by s minus each side and take the root. For 3, 4, 5: s = 6, and √(6×3×2×1) = √36 = 6. No angle is needed and no height is needed — three lengths are enough to fix an area completely.

At a glance

Formula shown
Area = \u221a(s(s\u2212a)(s\u2212b)(s\u2212c)) with s = (a+b+c)/2. Numerically, sort a \u2265 b \u2265 c and use \u00bc\u221a((a+(b+c))(c\u2212(a\u2212b))(c+(a\u2212b))(a+(b\u2212c))), which never subtracts two nearly equal large numbers.
Scenario support
A plot of land measured only by its sides; a triangle with no convenient height; checking an area computed another way.
Educational estimate
Planning support from the values you enter — not professional advice.

How the formula works

Three side lengths fix a triangle completely, so they must fix its area too. Heron’s formula is that area written down.

Take s = (a + b + c) ÷ 2, the semiperimeter. Then the area is √(s(s−a)(s−b)(s−c)).

Each of s−a, s−b and s−c is positive exactly when the three lengths can close into a triangle. If one of them is negative, the product goes negative and the root has no real value — the arithmetic refusing for the same reason the geometry does.

It generalises: Brahmagupta’s formula does the same for a cyclic quadrilateral, and reduces to Heron’s when one side shrinks to zero.

Why the order matters

Algebraically there is one formula. Numerically there are two, and they do not give the same answer on a thin triangle.

Take a = 100000, b = 99999.99999979, c = 0.00001. Here s−a and s−c are tiny differences between large numbers, and subtracting them first throws away most of the significant digits before anything is multiplied. The textbook form returns an area with about ten correct digits out of sixteen; on more extreme needles it returns zero, or NaN.

Kahan’s rearrangement sorts the sides so a ≥ b ≥ c and groups the terms as ¼√((a+(b+c))(c−(a−b))(c+(a−b))(a+(b−c))). Every subtraction is now between quantities of comparable size, and no digits are lost.

The parentheses are load-bearing. Evaluating the same expression in a different order reintroduces the problem, which is why the paper is careful about them and why this page follows it.

Worth noting what cannot be shown here: the textbook example uses a third side of 2.9 × 10⁻¹⁰, and adding that to 99999.99999979 in double precision rounds it away entirely — the sides then fail the triangle inequality before any area is computed. The example on this page is the smallest one that survives being typed in.

The degenerate case

Sides of 1, 2 and 3 give an area of exactly zero, and that is the correct answer rather than a failure.

1 + 2 = 3 exactly, so the two shorter sides just reach the end of the longest and the shape is a straight line. It is on the boundary of the triangle inequality: not a violation, but not a triangle with any interior either.

Go one step further — 1, 2 and 5 — and the sides cannot meet at all. The formula would ask for the root of a negative number, and the page refuses with the arithmetic that shows why.

Degenerate cases are worth handling deliberately because measured data produces them. Three surveyed distances that are very nearly collinear will land here, and returning NaN would be less useful than returning zero and saying so.

Heights from the area

Once you have the area, every height follows without any more geometry.

Area = ½ × base × height, so height = 2 × area ÷ base. Do that for each side in turn and you have all three altitudes.

This is genuinely useful: heights are awkward to measure and easy to compute. It is also why the precision of the area matters more than it looks — every height inherits whatever error the area has.

The inradius comes from the same place: r = area ÷ s. And the circumradius is abc ÷ (4 × area).

Where it is used

Surveying. A plot measured by walking its edges gives three lengths and no angles. Heron turns them into an area directly.

Triangulated shapes. Any polygon can be cut into triangles, and the total area is the sum. Computer graphics computes mesh areas exactly this way, millions of times a frame.

Coordinates. Given three points, the side lengths follow from Pythagoras and the area from Heron. The shoelace formula is usually quicker there, but Heron needs only distances, which is sometimes all you have.

Checking. An area computed as ½ab·sin C and again by Heron should agree. When they do not, one of the inputs is wrong.

Its history

Named for Hero of Alexandria, who proved it in his Metrica around 60 CE. The proof there is geometric and does not look much like the algebra.

Archimedes may have known it two centuries earlier — Arab commentators attribute it to him — and the Chinese Nine Chapters tradition arrived at an equivalent result independently.

The numerical difficulty is much more recent. It only appears once you compute in floating point, and Kahan’s note on it dates from 1986. Two thousand years of correct algebra, and a precision problem that is thirty-nine years old.

Sources and methodology

The formula is ancient and the numerical problem is documented; these are the references.

Method. The area is computed by sorting the sides and grouping the terms so that no step subtracts two nearly equal large numbers. The textbook form is computed separately and displayed beside it, with the disagreement reported when there is one — the point being to show the cost rather than assert it. The suite checks the stable form against ½ab·sin C, a completely different route, and separately checks that the textbook form really does fail on a needle. That engine is verified on every change against 76 hand-written assertions, including agreement with ½ab·sin C across four thousand generated triangles, and that the textbook form genuinely disagrees on a needle rather than the page merely claiming it would. The count and the per-case breakdown are published on the formula verification page.

Related calculators

Where this goes next:

TriangleSolve any triangle from three measurements — and when two sides and a non-included angle describe TWO triangles, this one shows both instead of picking one.
Pythagorean Theorema² + b² = c² solved for whichever side you leave blank, with the triangle drawn to scale and integer triples reduced to their primitive.
Similar TrianglesScale factor and the missing sides — plus the area factor, which is its square. Two pairs with different ratios are reported as not similar rather than averaged.
Special Right Triangles30-60-90 and 45-45-90 from any one side, in exact surd form as well as decimals — with the warning that the long leg is √3 times the short, not twice.
Square RootThe exact square root first — 72 gives 6 root 2 — then the decimal to as many as sixty places, computed on whole numbers rather than a double.
CircleRadius, diameter, circumference and area from any one of them — and why a 16-inch pizza is four times an 8-inch one rather than twice.

More in Math, or browse all calculators.

Read the guide

The Triangle Calculator gives this area alongside every angle, height and radius, and handles the cases where you have angles rather than three sides.

Educational use disclaimer

This is an educational tool. The stable form is exact to double precision for the lengths entered; the textbook column is shown for comparison and is not the answer.

How we calculate · Found an error? email us

Authorship & verification

Written and maintained by , a business operator who builds spreadsheet-based calculators.

What's changed (3 updates)

Published 7 September 2026

  1. Published Heron's formula in Kahan's numerically stable rearrangement, with the textbook form computed beside it: on a needle-shaped triangle the usual order loses about six significant digits out of sixteen.
  2. Says plainly what cannot be shown — the textbook Kahan example uses a third side of 2.9e-10, which rounds away entirely when added to the second side, so the inputs fail the triangle inequality before any area exists.
  3. Degenerate lengths return exactly zero and are labelled as such, rather than returning NaN, because measured survey data lands there.

Add this calculator to your site

Responsive embed — and private: nothing your visitors type leaves their browser.