Heron's Formula Calculator
Result
Area
- Perimeter
- 12.0000 cm
- Semiperimeter
- 6.0000 cm
A Heron's formula calculator takes the three side lengths of a triangle and returns the area it covers, the distance around it, and the semiperimeter — half the perimeter, which is the quantity the formula is built on. The page exists because of a gap that anyone measuring a real triangle runs into: the straightforward area formula, half the base times the height, needs a height, and a height is the one thing you cannot measure with a tape. It is a perpendicular dropped from a corner to the opposite side, you cannot lay a tape along it without propping a square against the triangle, and on a triangle drawn on paper or marked out on the ground it is usually easier to measure the three sides and stop. Heron's formula is the answer to that: with nothing but the three sides, the area comes out. It is usually attributed to Heron of Alexandria, who wrote it down in the first century, and it is one of the older results in applied mathematics — it was used for surveying land, where the three sides are exactly what a chain gives you. The formula is written around the semiperimeter, half the sum of the three sides, and the reason is worth noticing rather than skipping: with the semiperimeter called s, the area is the square root of s times s minus a, times s minus b, times s minus c. All four factors have to be positive for the answer to be a real number, and that is not an accident of the algebra — it is the triangle inequality in disguise, because s minus the longest side is positive exactly when the other two sides together are longer than it. Three sides that cannot close give a negative number under the square root and no triangle, and the page stops you before that with a message rather than handing back a NaN. The semiperimeter is printed on the panel rather than hidden, because it is the number to compare the sides against: if s is not larger than the longest side, the three lengths you typed cannot be a triangle.
Triangles by their three sides, from the whole-number ones to the degenerate case
| Side a (cm) | Side b (cm) | Side c (cm) | Semiperimeter (cm) | Area (cm²) | Perimeter (cm) |
|---|---|---|---|---|---|
| 3 | 4 | 5 | 6 | 6 | 12 |
| 5 | 5 | 6 | 8 | 12 | 16 |
| 6 | 6 | 6 | 9 | 15.5885 | 18 |
| 7 | 8 | 9 | 12 | 26.8328 | 24 |
| 2 | 3 | 4 | 4.5 | 2.9047 | 9 |
| 1 | 1 | 2 | 2 | 0 | 4 |
| 5 | 12 | 13 | 15 | 30 | 30 |
| 9 | 10 | 17 | 18 | 36 | 36 |
Eight triangles, and the first row is the one the page loads with. The fifth column is the one to read down: it is zero only in the sixth row, where the sides are 1, 1 and 2 and the triangle has flattened into a straight line, and that is the exact boundary the page lets through. One step further out — 1, 1 and 2.1 — and no triangle exists, which is what the guard is for. Three rows are cross-checks against the pages beside this one, all of them landing on the same figure from different inputs: 3, 4 and 5 gives 6, the same area the triangle area page reaches from a base of 3 and a height of 4; 6, 5 and 5 gives 12 and a perimeter of 16, matching the isosceles page at a base of 6 with legs of 5; and 6, 6 and 6 gives 15.5885, matching both the equilateral page at a side of 6 and the isosceles page at a base and leg of 6. Three pages, three descriptions of one triangle, one area each time. The last two rows look like a mistake and are not: 5-12-13 has an area of 30 and a perimeter of 30, and 9-10-17 has 36 and 36. The first is a Pythagorean triple and the second is not, which is the clue that the agreement is a coincidence of those shapes rather than a rule — the two figures are square centimetres and centimetres, and they would part company the moment the sides were measured in a different unit. Every number here is recomputed from its three sides when the page is built, in centimetres, and the four decimals are the same four decimals the results panel uses.
Formula
s = (a + b + c) ÷ 2 A = √(s(s − a)(s − b)(s − c)) P = a + b + c
- Side a
- The first of the three side lengths, in centimetres. The three boxes are interchangeable — swapping which side you call a and which you call b changes nothing about the answer — so type them in whatever order you measured them
- Side b
- The second side length, in centimetres. Along with the other two it has to satisfy the triangle inequality: each side must be shorter than the other two added together, or the three lengths cannot close into a triangle at all
- Side c
- The third side length, in centimetres. It is worth entering the longest side in any box you like and then reading the semiperimeter: the semiperimeter must be larger than it, and that single comparison is a quicker check than rebooting the three sums
- Semiperimeter
- Half the distance around the triangle, in centimetres: the three sides added and divided by two. It is printed as an answer rather than kept as a working step, because it is the quantity the formula is named around and because it doubles as the check that the three sides can meet
- Area
- The space the triangle covers, in square centimetres, from the square root of the semiperimeter times the three differences between it and each side. It is the only output that needs all three inputs: the perimeter only adds them and the semiperimeter only halves the sum
- Perimeter
- The distance all the way around, in centimetres: the three sides added. It is here because the two are easy to confuse when one is a step inside the other, and because a perimeter is what you buy edging or trim by
- √
- The square root, applied to the product of the four factors. Almost every triangle gives an irrational area, so a side-triple that produces a whole number — 3, 4, 5 giving 6, for instance — is the exception worth noticing rather than the rule
Reach for this page whenever you have measured the three sides and not the height, which is most of the time in practice. Land is the classic case: a plot with straight boundaries is surveyed by chaining the sides, and the area follows from them directly — split an irregular plot into triangles and run each one through here. Sheet material is another: a triangular gusset, a corner shelf or a sail is quoted by its three edges, and the area is what tells you the sheet you need and the weight it will add. In schoolwork it is the way to get an area when the height is awkward or would land outside the shape, which happens on any obtuse triangle: the perpendicular from the widest corner falls beyond the opposite side, so you cannot measure it along the material. The page is also the honest route when a triangle is given by three lengths that came out of somewhere else — a CAD export, a cutting list, a drawing dimensioned on its edges — since there is nothing to convert and nothing to measure again. Two things to watch. First, the three sides have to be able to close: if the longest is longer than the other two added together, no triangle exists and the page says so rather than returning a number, since the arithmetic would want the square root of a negative. Second, real measurements never satisfy the inequality exactly. A plot whose sides are quoted as 10, 4 and 6 metres cannot be a triangle, but the same plot measured to the nearest centimetre will come out as something like 10.01, 3.99 and 6.00, and the area will be tiny — which is the arithmetic telling you that the three points are very nearly in a straight line, not that the formula failed.
Worked examples
Sides of 3, 4 and 5
- Perimeter: 3 + 4 + 5 = 12
- Semiperimeter: 12 ÷ 2 = 6
- The three differences: 6 − 3 = 3, 6 − 4 = 2, 6 − 5 = 1
- Area: √(6 × 3 × 2 × 1) = √36 = 6
The 3-4-5 triangle, the one every right angle in building work is set out with, and the clearest case where the answer is a whole number. It is also the cross-check between this page and the triangle area page: base 3 with a height of 4 gives 6 there, and the three sides give 6 here. Same triangle, two sets of input, one area. The square root coming out exactly is a property of this triple, not of the formula — almost every other triple leaves an irrational number behind.
Sides of 6, 5 and 5
- Perimeter: 6 + 5 + 5 = 16
- Semiperimeter: 16 ÷ 2 = 8
- The three differences: 8 − 6 = 2, 8 − 5 = 3, 8 − 5 = 3
- Area: √(8 × 2 × 3 × 3) = √144 = 12
An isosceles triangle with a base of 6 and two sides of 5, which is the default the isosceles page beside this one loads with, and it returns the same 12 and the same perimeter of 16. That is the second of the two cross-checks in this batch: the isosceles page reaches its area from a base and a leg, this page reaches it from the three sides, and the two agree to the last digit. Notice that the semiperimeter of 8 is comfortably larger than the longest side of 6, which is the check that these three lengths close.
Sides of 6, 6 and 6
- Perimeter: 6 + 6 + 6 = 18
- Semiperimeter: 18 ÷ 2 = 9
- The three differences: 9 − 6 = 3, three times over
- Area: √(9 × 3 × 3 × 3) = √243 = 15.588457…, which rounds to 15.5885
The equilateral case, and the third route to the number 15.5885: the equilateral page gets it from a single side of 6, the isosceles page from a base of 6 with legs of 6, and this page from three sides of 6. Three pages, three ways of describing the same triangle, one area. √243 is 9√3, which is where the square root of three that the equilateral page carries in its constant turns up here.
Sides of 5, 12 and 13
- Perimeter: 5 + 12 + 13 = 30
- Semiperimeter: 30 ÷ 2 = 15
- The three differences: 15 − 5 = 10, 15 − 12 = 3, 15 − 13 = 2
- Area: √(15 × 10 × 3 × 2) = √900 = 30
The row that catches the eye: the area is 30 and the perimeter is 30. They are not the same quantity and they are not even in the same unit — one is square centimetres and the other is centimetres — it just happens that this particular triangle gives the same number twice. 5-12-13 is a Pythagorean triple, so it is right-angled, and right-angled triangles are the ones that are most likely to land on whole numbers because the squares of the sides are whole numbers too.
Sides of 9, 10 and 17
- Perimeter: 9 + 10 + 17 = 36
- Semiperimeter: 36 ÷ 2 = 18
- The three differences: 18 − 9 = 9, 18 − 10 = 8, 18 − 17 = 1
- Area: √(18 × 9 × 8 × 1) = √1296 = 36
The second row where the area and the perimeter print the same number, and this one is not a right-angled triangle: 9 squared plus 10 squared is 181, while 17 squared is 289. So the agreement of 36 and 36 is not coming from a right angle, which is what makes it worth pointing at. Two rows on one table doing it is exactly what makes the first one look like a rule, and this one is the evidence that it is not.
Sides of 1, 1 and 2
- Perimeter: 1 + 1 + 2 = 4
- Semiperimeter: 4 ÷ 2 = 2
- The three differences: 2 − 1 = 1, 2 − 1 = 1, 2 − 2 = 0
- Area: √(2 × 1 × 1 × 0) = √0 = 0
The exact boundary case, and it is allowed through rather than rejected: 1 plus 1 is exactly 2, so the triangle has flattened into a straight line with the two short sides laid end to end. The area is genuinely zero and the perimeter is genuinely 4, so an answer of zero here is correct rather than a sign of failure. Push the third side to 2.1 and the page refuses, because then the two short sides cannot reach and no triangle exists.
Limitations
The three numbers must be able to form a triangle: each side shorter than the other two added together. If they cannot, the page stops and says so rather than returning a number, because the formula would want the square root of a negative. The exact case where the longest side equals the other two added together is allowed through and gives an area of zero, which is the honest answer for a triangle that has flattened into a line. The outputs are in centimetres and square centimetres whatever the unit dropdown is set to, so sides entered in inches come back as a centimetre answer. Four decimal places is a display width rather than a claim about precision, and with three measured sides the error in each one carries into the area — a triangle measured to the nearest millimetre can easily have an area that is uncertain in the third decimal, so the last printed digit should not be read as meaningful. Heron's formula is also poor company for very thin triangles: when one side is nearly as long as the other two together, the four factors include a very small one and the square root amplifies whatever rounding was already in the measurements, so the area of a sliver is worth treating as approximate however many digits are printed. The page is two-dimensional and has no field for the thickness of a physical triangle, so it cannot give the volume of a prism or the weight of a plate.
Frequently asked questions
- Why would I use this instead of half the base times the height?
- Because a height is hard to measure and the three sides are easy. The height is a perpendicular from a corner to the opposite side, so measuring it means propping a square against the triangle, and on an obtuse triangle it falls outside the shape entirely. A tape along each side needs no such care, and Heron's formula turns those three readings into the area with no height anywhere in it. If you already have a base and a height, use the triangle area page: the arithmetic is shorter.
- What is the semiperimeter and why is it shown?
- It is half the perimeter, the three sides added and divided by two, and it is the quantity Heron's formula is written around: the area is the square root of s times s minus a, times s minus b, times s minus c. It is printed rather than kept as a working step because it doubles as a check. If the semiperimeter is not larger than the longest side, the three lengths cannot form a triangle, and that one comparison saves working through the three differences.
- What happens if the three sides cannot form a triangle?
- The page stops and tells you, rather than returning a number. Three lengths can only close if each one is shorter than the other two added together; when that fails, one of the four factors inside the square root comes out negative and there is no real area. The message names the longest side and what the other two add up to, so you can see how far out the measurements are. The one case that is allowed through is the exact boundary, where the longest side equals the other two added together: that triangle has genuinely flattened into a line and its area of zero is a real answer.
- Where does the name come from?
- From Heron of Alexandria, who recorded the formula in the first century, which makes it one of the older results still in everyday use. It was written for surveying, where the three sides of a plot are exactly what a measuring chain gives you and the height is not. It is sometimes called Hero's formula after the same person, whose name is spelled both ways in the sources.
- The area and the perimeter come out as the same number on some triangles. Is that a rule?
- No, and the table shows why not. The 5-12-13 triangle has an area of 30 and a perimeter of 30, and so does the 9-10-17 triangle, at 36 and 36 — but they are different quantities in different units, square centimetres against centimetres, and the equality depends entirely on which unit the lengths were in. Measure the same triangle in metres and the perimeter falls by a hundred while the area falls by ten thousand, and the two numbers part company. That is worth knowing before the coincidence is read as a property of triangles.
- How accurate is the area if I measured the sides with a tape?
- Less accurate than the four decimals suggest, and the error grows on thin triangles. Each measured side carries its own uncertainty into all four factors, and when one side is nearly as long as the other two together, one factor becomes very small and the square root amplifies whatever rounding is already in your numbers. Round the answer to match the measurement: if the sides are good to the nearest millimetre, the area is good to about three significant figures, whatever the panel prints after that.
References
- Heron's formula — the area of a triangle from its three side lengths by way of the semiperimeter, which is the whole of what this page computes, including the proof and the note on the degenerate case — Wolfram MathWorld (United States)
- Triangle — the general case, with the triangle inequality that decides whether three lengths can close, and the base-and-height area formula that the triangle area page beside this one uses — Wolfram MathWorld (United States)
- Semiperimeter — the half-sum of the sides that Heron's formula is written around, and which doubles as the cheapest test of whether three lengths form a triangle at all — Wolfram MathWorld (United States)
- 教育部关于印发义务教育课程方案和课程标准(2022 年版)的通知——The fifth item in the annex list of this notice is the Mathematics Curriculum Standards for Compulsory Education (2022 edition); the triangle inequality and the area of a triangle are part of the compulsory-education mathematics curriculum, and the wording of the standards and the grade-band breakdown are governed by that annex — 中华人民共和国教育部