Shoelace Formula
Find the area of any polygon from its corner coordinates by adding one signed triangle per edge
This concept builds on Vectors — Direction and Magnitude, Determinant. Consider exploring them first for the best experience.
One Edge, One Triangle
Start with the smallest part: one edge of the shape. Join both of its ends to the white point O and you get a triangle. If O is at (0, 0) and the edge runs from (x₁, y₁) to (x₂, y₂), twice that triangle's area is x₁y₂ − x₂y₁. Press 'Next edge' to add the triangle edges one at a time. For the edge P2 → P3, from (8, 2) to (4, 6), the 'Current edge' readout shows 8 × 6 − 4 × 2 = 40, a triangle of area 20.
Signs Keep the Score
The number comes with a sign. When the triangle turns counterclockwise as you walk from P to Q, the term is positive and it is drawn blue; when it turns clockwise, the term is negative and it is drawn orange. For the starting triangle the three terms are −4, 40 and −8. The big blue triangle covers the shape and some empty space too, and the two orange slivers remove exactly that extra space. The 'Running total' ends at 28.
Cross the Laces
Choose 'Shoelace table' in the 'Show' menu. The corners are listed in a column, x then y, with P1 written again at the bottom. Multiply each x by the y one row below it (the blue lace) and subtract the x one row below times the y beside it (the orange lace). The criss-crossing lines look like a laced shoe. The 'Shoelace sum' is twice the area, so the 'Area' readout halves it: 28 ÷ 2 = 14 square units.
Worked Example: A Four-Sided Field
Choose 'Quadrilateral' in the 'Shape' menu: corners (1, 1), (6, 2), (5, 6) and (2, 5). The four edge terms are 1 × 2 − 6 × 1 = −4, then 6 × 6 − 5 × 2 = 26, then 5 × 5 − 2 × 6 = 13, then 2 × 1 − 1 × 5 = −3. Their sum is 32, so the area is 32 ÷ 2 = 16 square units. Check it the slow way: the 5 × 5 box around the field is 25, and the four corner triangles plus one small square outside it cover 2.5 + 2 + 1.5 + 2 + 1 = 9, leaving 16.
Move the Point O
Drag the white point O anywhere, or use the 'O across' and 'O up' handles below the canvas. The triangles change completely: some flip from blue to orange, and the table now lists coordinates measured from O. Yet the 'Shoelace sum' never moves. Each edge's extra area is cancelled by its neighbours', because the edges form a closed loop that returns to where it started. O at (0, 0) is just the easiest choice.
Walk the Other Way
Press 'Reverse order'. The corners are now walked clockwise, every triangle turns the other way and every term flips its sign. The 'Shoelace sum' becomes −32 for the quadrilateral, but the area is still 16. So the sign of the sum tells you the direction the corners are listed in, shown in the 'Corner order' readout, and the size tells you the area. That is why the formula takes half the absolute value.
Dents and Crossings
Choose 'L-shape' in the 'Shape' menu. This shape has a dent, yet the formula still works: the sum is 48 and the area 24, which you can check by counting squares, 12 in the bottom bar and 12 in the upright. Now choose 'Bow tie'. Its edges cross, so one loop is walked counterclockwise and the other clockwise. Each loop has area 6, and the formula gives 6 − 6 = 0. The shoelace formula needs a polygon whose edges never cross.
How It Works — Step by Step
-
1
One Edge, One Triangle
Start with the smallest part: one edge of the shape. Join both of its ends to the white point O and you get a triangle. If O is at (0, 0) and the edge runs from (x₁, y₁) to (x₂, y₂), twice that triangle's area is x₁y₂ − x₂y₁. Press 'Next edge' to add the triangle edges one at a time. For the edge P2 → P3, from (8, 2) to (4, 6), the 'Current edge' readout shows 8 × 6 − 4 × 2 = 40, a triangle of area 20.
-
2
Signs Keep the Score
The number comes with a sign. When the triangle turns counterclockwise as you walk from P to Q, the term is positive and it is drawn blue; when it turns clockwise, the term is negative and it is drawn orange. For the starting triangle the three terms are −4, 40 and −8. The big blue triangle covers the shape and some empty space too, and the two orange slivers remove exactly that extra space. The 'Running total' ends at 28.
-
3
Cross the Laces
Choose 'Shoelace table' in the 'Show' menu. The corners are listed in a column, x then y, with P1 written again at the bottom. Multiply each x by the y one row below it (the blue lace) and subtract the x one row below times the y beside it (the orange lace). The criss-crossing lines look like a laced shoe. The 'Shoelace sum' is twice the area, so the 'Area' readout halves it: 28 ÷ 2 = 14 square units.
-
4
Worked Example: A Four-Sided Field
Choose 'Quadrilateral' in the 'Shape' menu: corners (1, 1), (6, 2), (5, 6) and (2, 5). The four edge terms are 1 × 2 − 6 × 1 = −4, then 6 × 6 − 5 × 2 = 26, then 5 × 5 − 2 × 6 = 13, then 2 × 1 − 1 × 5 = −3. Their sum is 32, so the area is 32 ÷ 2 = 16 square units. Check it the slow way: the 5 × 5 box around the field is 25, and the four corner triangles plus one small square outside it cover 2.5 + 2 + 1.5 + 2 + 1 = 9, leaving 16.
-
5
Move the Point O
Drag the white point O anywhere, or use the 'O across' and 'O up' handles below the canvas. The triangles change completely: some flip from blue to orange, and the table now lists coordinates measured from O. Yet the 'Shoelace sum' never moves. Each edge's extra area is cancelled by its neighbours', because the edges form a closed loop that returns to where it started. O at (0, 0) is just the easiest choice.
-
6
Walk the Other Way
Press 'Reverse order'. The corners are now walked clockwise, every triangle turns the other way and every term flips its sign. The 'Shoelace sum' becomes −32 for the quadrilateral, but the area is still 16. So the sign of the sum tells you the direction the corners are listed in, shown in the 'Corner order' readout, and the size tells you the area. That is why the formula takes half the absolute value.
-
7
Dents and Crossings
Choose 'L-shape' in the 'Shape' menu. This shape has a dent, yet the formula still works: the sum is 48 and the area 24, which you can check by counting squares, 12 in the bottom bar and 12 in the upright. Now choose 'Bow tie'. Its edges cross, so one loop is walked counterclockwise and the other clockwise. Each loop has area 6, and the formula gives 6 − 6 = 0. The shoelace formula needs a polygon whose edges never cross.
Key Takeaways
Each edge is a signed triangle
An edge from (x₁, y₁) to (x₂, y₂) and the point O make a triangle whose doubled area is x₁y₂ − x₂y₁, positive or negative by turning direction.
Half the sum is the area
Add the terms for every edge around the polygon and take half of the result's size: Area = |Σ(xᵢyᵢ₊₁ − xᵢ₊₁yᵢ)| ÷ 2.
Any reference point works
The signed triangles change when O moves, but over a closed loop the changes cancel, so the sum stays the same.
The sign gives the direction
Counterclockwise corners give a positive sum and clockwise corners a negative one; edges that cross make loops cancel, so the formula needs a simple polygon.
Connected Concepts
Cross Product
Each edge term x₁y₂ − x₂y₁ is the cross product of the two corner positions: twice the triangle's area, with a sign for its turning direction.
Determinant
Write two corners as the columns of a 2×2 matrix and the edge term is its determinant, the signed area the matrix stretches a square into.
Pick's Theorem
For corners on whole-number points, counting dots inside and on the edge gives the same area the shoelace sum does.
Heron's Formula
Heron finds a triangle's area from its three side lengths; the shoelace formula finds it from its three corner coordinates.
Integration
Adding signed slivers that cancel outside a shape is the same idea as a signed integral, and the shoelace sum is its version for straight edges.
Vectors
Moving the reference point O shifts every corner by the same vector, and the edge terms change in a way that always adds up to zero.