Polygon Calculator
Result
Area
- Perimeter
- 36.0000 cm
- Apothem
- 5.1962 cm
- Interior angle
- 120.00 °
- Number of diagonal lengths
- 2
A polygon calculator takes the number of sides of a regular polygon and the length of one of those sides, and returns five figures: the area, the perimeter, the apothem, the interior angle, and the number of different diagonal lengths the shape has. It is the general case of the three single-shape pages beside it, and the difference between them is the input rather than the output. A pentagon page knows it is dealing with five sides, so it asks for one number; this page has to be told how many sides there are before it can compute anything, and once it knows, the rest of the arithmetic is the same for every shape from a triangle to a thousand-sided figure. The five formulas are worth having in one place because four of them are the same shape repeated. The perimeter is the side times the number of sides, which is the one figure that is exact whenever the side is. The area is the number of sides divided by four times the tangent of pi over the number of sides, all times the side squared, and the constant in front of the side squared moves with the shape: it is 0.4330 for a triangle, 1 for a square, 1.7205 for a pentagon and 2.5981 for a hexagon, and it keeps growing from there — 31.5688 at twenty sides and 79577.2097 at a thousand — because the side is held fixed while the shape grows. The figure that does climb towards pi, 3.1416, is a different one: the area divided by the square of the distance from the centre out to a corner, which is 2 for a square and 2.5981 for a hexagon. The apothem, the distance from the centre out to the middle of a side, is the side divided by twice the tangent of pi over the number of sides. The interior angle is the side count minus two, times 180, divided by the side count — 60 degrees at three sides, 108 at five, 120 at six, 135 at eight, and 179.64 at a thousand. And the diagonals are the figures that change kind rather than size as the side count grows. A triangle has none, a square and a pentagon have one length of them, a hexagon has two, an octagon three, and a twelve-sided figure five. This page answers that with a count rather than with lengths, because a fixed list of outputs cannot hold a number of readings that itself depends on the input: there is no way to print the lengths without either printing two identical numbers at four and five sides or leaving the columns empty. The lengths themselves are on the three single-shape pages, where the shape is known and the count is not a variable. The table below is arranged the other way round from the ones on those pages — the side stays at 6 and the side count moves — so that the same edge can be followed from a triangle up to the point where the shape has stopped being a polygon in any practical sense and become a circle.
Regular polygons with a side of 6, from a triangle to a figure with a thousand sides
| Sides | Area (cm²) | Perimeter (cm) | Apothem (cm) | Interior angle (°) | Diagonal lengths |
|---|---|---|---|---|---|
| 3 | 15.5885 | 18 | 1.7321 | 60 | 0 |
| 4 | 36 | 24 | 3 | 90 | 1 |
| 5 | 61.9372 | 30 | 4.1291 | 108 | 1 |
| 6 | 93.5307 | 36 | 5.1962 | 120 | 2 |
| 7 | 130.8208 | 42 | 6.2296 | 128.57 | 2 |
| 8 | 173.8234 | 48 | 7.2426 | 135 | 3 |
| 10 | 276.9915 | 60 | 9.2331 | 144 | 4 |
| 12 | 403.0615 | 72 | 11.1962 | 150 | 5 |
| 20 | 1136.4753 | 120 | 18.9413 | 162 | 9 |
| 1000 | 2864779.5509 | 6000 | 954.9265 | 179.64 | 499 |
Ten shapes that all have the same edge length, so the columns read as a single shape growing rather than as ten different sizes. Three rows of this table are the reconciliation with the three single-shape pages: at five sides the area is 61.9372, at six 93.5307, at eight 173.8234, which are the numbers pentagon-calculator, hexagon-calculator and octagon-calculator each load with. If those three ever disagree with these three cells, the general formula has drifted from the shape-specific ones. The first column is the input that makes this page different from its siblings, and the last two columns are the ones that do not move when the side moves — the interior angle is fixed by the side count alone, and the diagonal count is a count of lengths rather than of diagonals. Watch the interior angle column's display width: whole-number angles print here as 60, 90, 108, 120, 135 and 144, because the table prints the number itself, while the results panel above prints them as 60.00 and the heptagon's 128.57 appears at both. That is one quantity at two widths, not two answers. The bottom row is the reason the page stops at a thousand sides: a figure with a thousand sides and a perimeter of 6000 has an area of 2864779.5509 against 2864788.9757 for a true circle of the same perimeter, a difference of 0.0003 per cent, so past this row the side length has stopped saying anything about the shape. Every cell is recomputed from its row when the page is built, in centimetres, square centimetres and degrees.
Formula
A = n ÷ (4·tan(π ÷ n)) × s² P = n·s a = s ÷ (2·tan(π ÷ n)) interior angle = (n − 2) × 180 ÷ n diagonal lengths = ⌊n ÷ 2⌋ − 1
- n
- The number of sides, and the only input on this page that changes what shape you are looking at rather than how big it is. It must be a whole number of at least three: two sides enclose nothing, and half a side is not a side. Everything except the perimeter is a curved function of it, which is why this page prints the same side at ten different side counts instead of the ten different sides the three single-shape pages print
- s
- The length of any one side, in centimetres. As on every regular polygon page this is the only length there is: the shape is fixed by having all sides equal and all angles equal, so one side and the count determine the whole figure
- A
- The area, in square centimetres: the number of sides divided by four times the tangent of pi over the number of sides, times the side squared. The factor in front of the side squared is 0.4330 at three sides and grows without bound from there — it passes 1 at the square, is 31.5688 at twenty sides and 79577.2097 at a thousand — because a fixed side on a shape with more corners covers more ground. Hold the perimeter fixed instead and the growth does stop: a thousand-sided figure with a perimeter of 6000 covers 2864779.5509 against 2864788.9757 for the circle of the same perimeter, a difference of 0.0003 per cent. The figure that climbs towards pi, 3.1416, is the area divided by the square of the distance from the centre out to a corner
- P
- The perimeter, in centimetres: the side times the number of sides. It is the one output that is exactly linear in both inputs and the only one that is exact whenever its inputs are, which makes it the figure to check the others against when a result looks wrong
- a
- The apothem, in centimetres: the distance from the centre straight out to the midpoint of a side, which is the side divided by twice the tangent of pi over the number of sides. It is the radius of the largest circle that fits inside the shape, and twice it is the width across the flats — the measurement you can actually get a rule across
- Interior angle
- The angle between two neighbouring sides, inside the shape: the side count minus two, times 180, divided by the side count. It does not depend on the side length at all, so it is the same number on every row of a table whose side is fixed and whose side count moves. This page prints it to two decimals because a heptagon's is 128.571428 and would otherwise be rounded to 129, which is not a shorter answer but a wrong one
- ⌊n ÷ 2⌋ − 1
- How many different diagonal lengths the shape has. The chords joining pairs of corners come in half the side count of distinct lengths, and one of those is the side itself, so a triangle has none, a square and a pentagon have one each, a hexagon two, an octagon three. This is a count and not a length, so it carries no unit and does not move when the side does
- π
- The ratio of a circle's circumference to its diameter, about 3.14159265. It appears here because the tangent of pi over the number of sides is what couples the shape to its own corners: the same constant that describes the circle these shapes approach as the side count rises
This page is the one to use when the shape is not one of the named ones, or when the point of the question is the shape itself rather than a measurement of it. If you know you are dealing with a hexagon or an octagon, the page for that shape asks for one number instead of two and prints the diagonal lengths as well; come here when the side count is what you are choosing. That is the situation whenever a shape is being picked rather than measured — how many sides a raised bed, a gazebo roof, a coin or a tile should have — because the table lets you read the same edge at ten side counts in one column and see what each extra side buys. The pattern is worth stating plainly, and it comes in two halves that are easy to mix up. At a fixed side, every side added buys area and the amounts grow rather than shrink: going from three sides to four adds 20.4 square centimetres to a six-centimetre edge, from four to five adds 25.9, from five to six adds 31.6, and the run from twenty sides to a thousand adds 2863643, because the shape is growing as well as rounding and the perimeter grows with it. Hold the perimeter fixed instead and the trade reverses. At a perimeter of 6000 the single step from five sides to six buys 120589 square centimetres, while the whole run from twenty sides to a thousand — 980 extra sides — buys 23591. That is the comparison the last two columns of the table are for, and it is why a bolt head, a floor tile and a honeycomb cell are hexagons: past six sides the extra area stops being worth the extra edge to cut and the extra corner to fit. The apothem column is for laying a shape out on a sheet, since twice it is the width across the flats, and the interior angle column is for building one out of pieces, since half of it is the mitre each piece needs and it is the same for every size of that shape. If you are comparing this page with the circle calculator, the thousand-sided row is the honest comparison: at a side of 6 its perimeter is 6000 and its area is 2864779.5509, against 2864788.9757 for a true circle of the same perimeter, a difference of 0.0003 per cent.
Worked examples
A hexagon, side 6
- Perimeter: 6 × 6 = 36
- Interior angle: (6 − 2) × 180 ÷ 6 = 720 ÷ 6 = 120, exact
- Apothem: 6 ÷ (2 × tan 30°) = 6 ÷ 1.154700… = 5.196152…, which rounds to 5.1962
- Area: 6 ÷ (4 × tan 30°) × 36 = 2.598076… × 36 = 93.530743…, which rounds to 93.5307
- Diagonal lengths: ⌊6 ÷ 2⌋ − 1 = 3 − 1 = 2
The input the page loads with, and the row that reconciles this page with the hexagon page: 93.5307 and 5.1962 are the two numbers hexagon-calculator shows before you touch anything. The count of 2 in the last column is also the hexagon page's two diagonals — one that skips a corner and one that goes straight across — written as a count rather than as lengths, which is what this page can do and that one cannot. The interior angle of 120 prints here as 120.00 in the results panel, and as 120 in the table below, which is the same number at two display widths.
A triangle, side 6
- Perimeter: 3 × 6 = 18
- Interior angle: (3 − 2) × 180 ÷ 3 = 180 ÷ 3 = 60, exact
- Apothem: 6 ÷ (2 × tan 60°) = 6 ÷ 3.464101… = 1.732050…, which rounds to 1.7321
- Area: 3 ÷ (4 × tan 60°) × 36 = 0.433012… × 36 = 15.588457…, which rounds to 15.5885
- Diagonal lengths: ⌊3 ÷ 2⌋ − 1 = 1 − 1 = 0
The smallest shape the page accepts, and the only one on it with no diagonals at all: every chord joining two corners of a triangle is one of its three sides, so there is nothing left over to be a diagonal. The zero is an answer rather than an empty cell, and the area of 15.5885 agrees with equilateral-triangle-calculator at the same side, which is the check that the general formula has not drifted from the shape-specific one. Note the apothem: at three sides it is the shortest of any shape on the table, 1.7321 against a side of 6, because the circle inside a triangle is small relative to the triangle.
A heptagon, side 6
- Perimeter: 7 × 6 = 42
- Interior angle: (7 − 2) × 180 ÷ 7 = 900 ÷ 7 = 128.571428…, which rounds to 128.57
- Apothem: 6 ÷ (2 × tan 25.714285…°) = 6 ÷ 0.963149… = 6.229585…, which rounds to 6.2296
- Area: 7 ÷ (4 × tan 25.714285…°) × 36 = 3.633912… × 36 = 130.820846…, which rounds to 130.8208
- Diagonal lengths: ⌊7 ÷ 2⌋ − 1 = 3 − 1 = 2
The row this page exists for, and the one the octagon page warned about. Every side count up to twelve gives a whole-number interior angle except seven and eleven, so a page that printed angles with no decimals at all would print 129 here — not a coarser answer but a wrong one. Two decimals is enough for every side count the page accepts: at a thousand sides the angle is 179.64, still two decimals from 180. The seven-sided shape is also the first with fewer distinct diagonal lengths than it feels like it should have: a heptagon has fourteen diagonals in total, but they come in only two lengths, 2 and 3 corners skipped, because the rest are the same two spans measured from other corners.
A square, side 6
- Perimeter: 4 × 6 = 24
- Interior angle: (4 − 2) × 180 ÷ 4 = 360 ÷ 4 = 90, exact
- Apothem: 6 ÷ (2 × tan 45°) = 6 ÷ 2 = 3, exact
- Area: 4 ÷ (4 × tan 45°) × 36 = 1 × 36 = 36
- Diagonal lengths: ⌊4 ÷ 2⌋ − 1 = 2 − 1 = 1
The square, where the general formula runs into a floating-point snag worth knowing about: the tangent of 45 degrees is 1 mathematically, but the page computes the tangent of pi over four in floating point and gets 0.9999999999999999, so the area arrives as 36.000000000000014. It prints as 36 because the result is rounded to four decimals on the way out, which is what that rounding is for. The last column is the other thing to look at here: a square has two diagonals, they cross the shape the same way, and ⌊4 ÷ 2⌋ − 1 counts them as one length, which is correct and is exactly the trap this page avoids by not printing lengths.
A thousand sides, side 6
- Perimeter: 1000 × 6 = 6000
- Interior angle: (1000 − 2) × 180 ÷ 1000 = 179640 ÷ 1000 = 179.64, exact
- Apothem: 6 ÷ (2 × tan 0.18°) = 6 ÷ 0.006283… = 954.926539…, which rounds to 954.9265
- Area: 1000 ÷ (4 × tan 0.18°) × 36 = 79577.2097… × 36 = 2864779.5509…, which rounds to 2864779.5509
- Diagonal lengths: ⌊1000 ÷ 2⌋ − 1 = 500 − 1 = 499
The upper limit of the page, and the row that answers a question the other pages in this family can only talk about. A regular figure of a thousand sides with a perimeter of 6000 has an area of 2864779.5509 square centimetres; a true circle with the same perimeter has 2864788.9757, which is 0.0003 per cent more. Its apothem of 954.9265 sits against the circle's radius of 954.9297, a difference of 0.0032 of a centimetre. So this is where the polygon has stopped being a polygon in any practical sense — which is why the page does not accept more than a thousand sides: past this point the side length has stopped describing the shape and the figure is a circle with extra steps.
Limitations
The page is for regular polygons only: all sides the same length and all angles equal. A shape with unequal sides or unequal angles has no single side length and no single interior angle, and no number of inputs to this page will describe it — enter a side count and a side and the page will quietly answer with the regular shape of that size, without telling you that the shape you have in mind is a different one. The side count must be a whole number of at least three, and the page reports an error rather than rounding if it is not; anything above a thousand is refused as well, because past that the shape is a circle for every purpose the numbers here could serve. The outputs are in centimetres and square centimetres whatever the unit dropdown is set to, so a side entered in inches comes back as a centimetre answer you have to convert yourself. Four decimal places is a display width rather than a claim about precision, and it is generous for a measured side; the last two digits are not meaningful unless the input was exact. The interior angle carries two decimals rather than none, which means whole-number angles print as 120.00 here and as 120 on the pentagon and octagon pages — the same number at two display widths, not a disagreement between the pages. The last two columns are a count and an angle and neither moves when the side moves, so a page that appears not to respond to a change of side has not frozen: three of the five figures changed. There is one diagonal figure here and it is a count, not a length: the lengths themselves are on the three single-shape pages, and the reason is that their number depends on the side count, which a fixed list of outputs cannot hold. The page is two-dimensional and has no field for material thickness, so it cannot give the volume of a prism or the weight of a plate cut from one of these shapes, and the diagonal count is a count of distinct lengths rather than of diagonals — a heptagon has fourteen diagonals and this page says two, both statements being true of different quantities.
Frequently asked questions
- How do I find the area of a regular polygon from its side?
- Multiply the square of the side by the number of sides, then divide by four times the tangent of pi divided by the number of sides. The factor that multiplies the square of the side depends only on the side count — 0.4330 for a triangle, 1 for a square, 1.7205 for a pentagon, 2.5981 for a hexagon — and it grows without bound as the side count rises — 3.6339 at seven sides, 31.5688 at twenty, 79577.2097 at a thousand. It is the area rather than this factor that approaches a circle's, and only when the perimeter is held fixed; the factor that climbs towards pi, 3.1416, is the area divided by the square of the centre-to-corner distance. Because it is a factor rather than a term, doubling the side quadruples the area for any shape on this page.
- Why does the interior angle not change when I change the side length?
- Because the interior angle of a regular polygon is fixed by the number of sides and nothing else: it is the side count minus two, times 180 degrees, divided by the side count. No side length appears in that expression. A triangle is always 60 degrees, a pentagon always 108, a hexagon always 120, an octagon always 135, whatever the size. It is why the fourth column of the reference table is predictable rather than measured, and why the mitre you cut for a hexagonal frame is 30 degrees whether the frame is a coaster or a table.
- How many diagonals does a polygon have?
- Two different questions live inside that one, and this page answers the second. The number of diagonals is the side count times the side count minus three, divided by two: a pentagon has five, a hexagon nine, an octagon twenty. The number of different diagonal lengths is half the side count, rounded down, minus one: a pentagon has one, a hexagon two, an octagon three, a heptagon two. This page prints the second, because that is the figure the single-shape pages beside it are built around, and because a count of lengths is the only diagonal figure that stays true for every side count.
- What is the apothem, and what is it for?
- It is the distance from the centre straight out to the middle of a side, and it is the radius of the largest circle that fits inside the shape. It is the figure to lay a polygon out with, because twice the apothem is the width across the flats and the flats are what a rule can measure; the corners are not. If you are marking a shape out on a sheet, measure the apothem out from the centre as many times as there are sides and you have the midpoint of every side. At three sides it is small relative to the shape, and it approaches the radius of the circumscribed circle as the side count rises.
- When should I use this page instead of the pentagon or octagon page?
- When the number of sides is what you are deciding rather than what you already know. The single-shape pages ask for one number and give you the diagonal lengths as well, because they know which shape they are dealing with; this page asks for two numbers, and in exchange it will handle any side count from three to a thousand and let you read the same side at ten of them in one column. If you have a fixed hexagon to measure, the hexagon page is fewer steps. If you are choosing between a hexagon and an octagon for a table top, this page is the comparison.
- What does the perimeter column tell me that the area column does not?
- It tells you what the shape costs to build, where the area tells you what it covers. The perimeter is the side times the number of sides, so at a fixed side it rises in a straight line while the area climbs with it: going from a triangle to a square adds 6 to the perimeter and 20.4 to the area of a six-centimetre edge, but going from twenty sides to a thousand adds 5880 to the perimeter and 2863643 to the area, which is a great deal more edge for a shape that looks no different to the eye. Fix the perimeter instead and the trade runs the other way: at a perimeter of 6000, one extra side at the five-to-six step buys 120589 square centimetres, while the last 980 sides together buy 23591. That is why a bolt head and a floor tile are hexagons rather than shapes with more sides — past six, the extra edge costs more than the extra area is worth.
References
- Regular polygon — the family this page covers end to end, with the area, the apothem, the interior angle and the diagonal structure all defined in terms of the side count — Wolfram MathWorld (United States)
- Apothem — the distance from the centre of a regular polygon to the midpoint of a side, which is the radius of the inscribed circle and, doubled, the width of the shape across its flats — Wolfram MathWorld (United States)
- Polygon — the general closed figure this page specialises to the regular case, including the distinction between the number of diagonals and the number of distinct diagonal lengths — 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 number of sides, interior angles, perimeter and area of a regular polygon are part of the compulsory-education mathematics curriculum, and the wording of the standards and the grade-band breakdown are governed by that annex — 中华人民共和国教育部