Shoelace Formula Calculator: How to Compute Polygon Area from Vertex Coordinates
About the Author

A shoelace formula calculator turns a bare list of corner coordinates into an exact area — five points, ten multiplications, one subtraction, and you are done. No trigonometry, no splitting the shape into triangles, no measuring anything on the ground. It works on a 300-vertex GIS boundary just as happily as on a homework quadrilateral, and it is exact for any polygon whose edges do not cross, convex or not. Below: the algorithm run on real numbers, the reason those cross products add up to an area in the first place, the three inputs that make it return a confident wrong answer, and the integer-lattice trick that lets you verify the result without repeating the arithmetic.
Running the Lacing on a Five-Corner Parcel
Take a plot with corners at (0, 0), (40, 0), (55, 25), (25, 45) and (0, 30), in metres, listed counterclockwise. Write the coordinates in a column, repeat the first pair at the bottom, then multiply diagonally — down-right for one column, up-right for the other. That criss-cross is where the name comes from; it looks like the lacing on a shoe.
| Vertex | xi · yi+1 | xi+1 · yi | Difference |
|---|---|---|---|
| (0, 0) | 0 · 0 = 0 | 40 · 0 = 0 | 0 |
| (40, 0) | 40 · 25 = 1,000 | 55 · 0 = 0 | 1,000 |
| (55, 25) | 55 · 45 = 2,475 | 25 · 25 = 625 | 1,850 |
| (25, 45) | 25 · 30 = 750 | 0 · 45 = 0 | 750 |
| (0, 30) | 0 · 0 = 0 | 0 · 30 = 0 | 0 |
| Totals | 4,225 | 625 | 3,600 |
Halve the difference and the parcel is 1,800 m² — 0.18 hectares, or 0.4448 acres. Written compactly, that whole procedure is:
A = ½ · | Σ (xi · yi+1 − xi+1 · yi) |
with the index wrapping: vertex n+1 means vertex 1
Two details do most of the damage when people run this by hand. The wrap-around term is genuinely part of the sum — forget the last row and you get an open path, not a polygon. And the vertices must be in walking order around the boundary. A sorted-by-x spreadsheet column is not a polygon, it is a zigzag.
Why Cross-Multiplying Coordinates Produces an Area at All
Each term xiyi+1 − xi+1yi is the 2×2 determinant of the two vectors running from the origin to consecutive vertices. Geometrically it is twice the signed area of the triangle formed by the origin and that one edge. So the shoelace formula is nothing more exotic than fanning the whole polygon into triangles from the origin and adding them up — the same determinant that a cross product calculator returns as the z-component of u × v.
The clever part is what happens to the triangles that stick out. If the origin sits outside the polygon, several of those origin-triangles cover ground the polygon never touches. They still get counted — but with opposite signs, because the edges that create them are traversed in the opposite rotational direction. The overshoot cancels exactly. That is why you can put the origin anywhere, including a kilometre away, and still get the right answer: only the difference of the sweeps survives.
A worked demonstration makes it concrete. On the parcel above, the origin is a vertex, so two of the five terms are zero and the shape decomposes into three triangles of 500, 925 and 375 m². Slide the whole plot 1,000 m east and every individual term explodes into the millions — yet the differences still sum to 3,600. Area is translation invariant, and the algebra knows it. You can see the same cancellation live in the “How each edge contributes” bars in the calculator: on a non-convex shape some bars are red, and the red ones are the overshoot being subtracted back off.
The Minus Sign Is Information, Not a Mistake
Drop the absolute-value bars and the shoelace sum keeps a sign, and that sign tells you which way you walked. Counterclockwise gives a positive result, clockwise a negative one. Most textbooks bury this under the modulus and move on, which is a shame, because in code the sign is often the reason you called the function.
| Field | Convention | What a wrong sign causes |
|---|---|---|
| Computer graphics | CCW = front face | Back-face culling hides the polygon |
| GeoJSON / OGC | CCW outer ring, CW holes | Holes render as solid fill |
| CNC and CAM | CCW = climb-mill outer profile | Cutter offsets to the wrong side of the line |
| Land surveying | CW traverse is traditional | Nothing — the sign is dropped before reporting |
A useful consequence: a polygon with holes needs no special handling. List the outer ring counterclockwise and each hole clockwise, run the shoelace sum over all of them, and the negative hole areas subtract themselves. That is how a doughnut-shaped parcel gets its net area in one pass.
Three Inputs That Return a Confident, Wrong Number
The shoelace formula has no way to complain. Feed it nonsense and it returns a clean number with no warning attached, which is exactly what makes it dangerous in a spreadsheet. These are the three failure modes worth recognising on sight.
| Bad input | Symptom | Fix |
|---|---|---|
| Points out of order | Area far too small; plot looks like a star or a zigzag | Re-walk the boundary, or sort by angle about the centre |
| Edges that cross | Lobes cancel — a perfect bowtie reports exactly 0 | Split into simple polygons and sum the parts |
| First point repeated at the end | Usually harmless, but breaks vertex counts and Pick’s theorem | Drop the duplicate — the wrap is implied |
The bowtie is worth trying yourself. Take the square (0,0), (4,4), (4,0), (0,4) — four perfectly good points, listed in an order that makes the edges cross in the middle. The shoelace sum returns 0. Not an error, not a NaN: zero, because the upper triangle is traced counterclockwise and the lower one clockwise, and 8 − 8 = 0. Any polygon whose edges cross gives you the difference of the lobes, and no amount of taking absolute values afterwards recovers the real enclosed area.
The out-of-order case is subtler and far more common, because it usually comes from a spreadsheet sorted by column. A rectangle’s corners sorted by x gives you a bowtie every single time. If you only have an unordered cloud of boundary points, sorting them by their angle around the centroid restores a valid loop for convex shapes — that is exactly what the “Sort points around the centre” button does. For genuinely concave outlines, there is no shortcut: you have to record the points in the order you walked them.
Integer Corners? Pick’s Theorem Checks Your Work for Free
When every vertex lands on a whole-number grid point, there is a second, completely independent way to get the area — and agreement between the two is about as close to a proof as a hand calculation gets. Pick’s theorem says:
A = I + B/2 − 1
I = interior lattice points, B = lattice points on the boundary
Try it on the L-shaped lot (0,0), (6,0), (6,3), (3,3), (3,6), (0,6). Shoelace gives 27. For Pick’s side, count boundary points edge by edge using gcd(|Δx|, |Δy|): the six edges contribute 6 + 3 + 3 + 3 + 3 + 6 = 24 boundary points. Counting the interior grid points gives 16. Then 16 + 24/2 − 1 = 16 + 12 − 1 = 27. Two entirely different countings, same answer.
Pick’s theorem is fussier than the shoelace formula: it needs integer coordinates and a non-self-intersecting outline, and it says nothing about a triangle with corners at (0, 0), (1, 0) and (0, 0.5). But when it does apply it is a genuine cross-check rather than a repeat of the same arithmetic, which is why it beats simply running the sum twice. There is a readable proof sketch and the lattice-counting details on Wikipedia’s Pick’s theorem page.
Surveyor’s Formula: Bearings In, Acres Out
Surveyors have used this since Gauss, which is why it is also called the surveyor’s formula or Gauss’s area formula. Field data does not arrive as coordinates, though — it arrives as a traverse of bearings and distances. Converting is two lines of trigonometry per leg:
departure (Δx) = distance · sin(bearing)
latitude (Δy) = distance · cos(bearing)
xi+1 = xi + Δx · yi+1 = yi + Δy
Run those around the traverse starting from (0, 0), and if the last leg does not land back on the origin you have a closure error to distribute before the area means anything. A traverse that misses by 0.3 m over a 400 m perimeter is a 1:1,333 closure — acceptable for a rural boundary, not for a city lot. Once it closes, the shoelace sum gives square metres or square feet, and the conversions are worth memorising: divide m² by 4,046.86 for acres, or ft² by 43,560. That second number is not arbitrary — an acre is 10 square chains, and a surveyor’s chain is 66 feet, so 10 × 66² = 43,560.
One trap catches programmers rather than surveyors: real-world coordinates are enormous. A UTM easting near 512,340 and a northing near 4,830,112 produce cross products around 2.5 × 10¹² for a lot covering 3,182.94 m². You are subtracting trillion-scale numbers to recover a thousand-scale answer, and the digits you need live at the very bottom of that subtraction. In 64-bit floating point the damage is modest — the raw sum lands on 3,182.9402, wrong in the eighth significant figure. Drop to 32-bit floats, still common in graphics pipelines and some GIS tooling, and the same four vertices return 131,072 m². Forty times too big, with no error raised.
The fix is one line: subtract the first vertex from every point before summing. Area is unaffected by translation, so the answer is identical in exact arithmetic but the numbers being multiplied shrink from 10¹² to 10³. That shifted sum returns 3,182.93994 even in single precision. This calculator does the shift internally on every input and flags it in the results panel whenever your coordinates cross six figures.
When a Shoelace Formula Calculator Is the Wrong Tool
A shoelace formula calculator wins whenever you already hold coordinates. It loses whenever you do not, and reaching for it anyway means inventing corner positions you never actually measured.
| You have | Use | Cost |
|---|---|---|
| n vertex coordinates | Shoelace formula | 2n multiplications, exact |
| Three side lengths only | Heron’s formula | One square root; unstable on sliver triangles |
| Side count and one length | Regular polygon formulas | Constant time, but only for equal sides |
| A curved boundary | Green’s theorem or a planimeter | Needs a parametrised curve or a physical trace |
| A scanned map image | Digitise the outline, then shoelace | Accuracy limited by your click precision |
Heron’s formula deserves a specific warning here. On a long thin triangle — say sides 100, 100 and 0.02 — the classic s(s−a)(s−b)(s−c) form subtracts nearly equal numbers and can lose half its digits. The shoelace determinant on the same triangle has no such cancellation. If you can get coordinates, prefer them, and use a triangle area calculator for the side-length case only when coordinates genuinely are not available.
What Else Drops Out of the Same Cross Products
Once the term list exists, three more quantities are basically free. The centroid of the plate — not the average of the vertices, which is a different and usually wrong point — reuses each cross term weighted by the midpoint sums:
Cx = (1 / 6A) · Σ (xi + xi+1) · (xiyi+1 − xi+1yi)
Cy = (1 / 6A) · Σ (yi + yi+1) · (xiyi+1 − xi+1yi)
Note the signed A in the denominator, not the absolute value — the sign has to survive or a clockwise polygon returns a centroid mirrored through the origin. For the five-corner parcel this lands at (24.24, 19.51) m, which sits well inside the plot; on an L-shaped or crescent outline the centroid can fall outside the polygon entirely, and that is not a bug.
Convexity comes from the same determinant applied to consecutive triples: if every turn bends the same way, the polygon is convex, and a single sign flip marks a reflex corner. Perimeter needs only the distance formula applied edge by edge, and the edge midpoints — handy for labelling a plan — come straight from the midpoint formula. For the wider family of area methods across shapes that are not polygons at all, the general area calculator covers circles, ellipses and sectors, and the perimeter calculator handles their boundaries.
That is the real argument for learning this one properly rather than treating it as a formula to look up. One pass over the vertex list, one array of determinants, and you have the area, the winding direction, the centroid, the convexity and a ready-made check on all of it. There is a good technical write-up of the derivation and its variants on Wikipedia’s shoelace formula article if you want the full proof rather than the sketch above.



