Home › Math › Polygon Area Calculator (Shoelace Formula)
Polygon Area Calculator (Shoelace Formula)
Computes the area of a simple polygon from its vertex coordinates with the shoelace (Gauss) formula, plus its perimeter, centroid, orientation and whether it is convex.
When to use
You have the (x, y) coordinates of a polygon's vertices in order around its boundary and need its area, centroid or perimeter, e.g. a land parcel, floor plan or map shape.
Do not use when: The polygon is regular and you know only its side length (use regular-polygon), it is a triangle given by side lengths (use triangle-area), or the edges cross each other (the shoelace formula is not valid for self-intersecting polygons).
Formula
A = ½ |Σᵢ (xᵢ·yᵢ₊₁ − xᵢ₊₁·yᵢ)| (indices wrap around); perimeter = Σ √((xᵢ₊₁ − xᵢ)² + (yᵢ₊₁ − yᵢ)²); centroid = (Σ (xᵢ + xᵢ₊₁)·cᵢ, Σ (yᵢ + yᵢ₊₁)·cᵢ) / (6·A_signed) with cᵢ = xᵢ·yᵢ₊₁ − xᵢ₊₁·yᵢ
Inputs
| Parameter | Type | Unit | Required | Description |
|---|---|---|---|---|
points | string_list | yes | Vertices as x,y pairs in boundary order (clockwise or counter-clockwise), at least 3, e.g. 0,0 4,0 4,3 0,3. A repeated first point at the end is ignored. |
Outputs
| Output | Type | Unit | Description |
|---|---|---|---|
area | number | |Σ (xᵢ·yᵢ₊₁ − xᵢ₊₁·yᵢ)| / 2 in the coordinate unit squared. | |
perimeter | number | Sum of the edge lengths, including the closing edge. | |
centroid_x | number | x of the area centroid, Σ (xᵢ + xᵢ₊₁)(xᵢ·yᵢ₊₁ − xᵢ₊₁·yᵢ) / (6·A). | |
centroid_y | number | y of the area centroid. | |
centroid | string | The centroid as a coordinate pair, e.g. '(2, 1.5)'. | |
is_convex | boolean | true when every turn along the boundary is in the same direction. | |
orientation | string | 'counter-clockwise' (positive signed area) or 'clockwise'. | |
vertex_count | integer | Vertices used after dropping a repeated closing point. |
Example
Rectangle 4 × 3: {"points":["0,0","4,0","4,3","0,3"]} → {"area":12,"perimeter":14,"centroid_x":2,"centroid_y":1.5,"centroid":"(2, 1.5)","is_convex":true,"orientation":"counter-clockwise","vertex_count":4}
Pentagon (3,4) (5,11) (12,8) (9,5) (5,6): {"points":["3,4","5,11","12,8","9,5","5,6"]} → {"area":30,"perimeter":26.090056,"centroid_x":7.166667,"centroid_y":7.611111,"is_convex":false,"orientation":"clockwise","vertex_count":5}
GET https://tttkmbb.com/api/v1/calculate/polygon-area?points=0%2C0%2C4%2C0%2C4%2C3%2C0%2C3
Machine access
- API:
GET https://tttkmbb.com/api/v1/calculate/polygon-area(query parameters) orPOSTwith a JSON body{"inputs": {...}} - Schema: https://tttkmbb.com/api/v1/calculators/polygon-area · Markdown: https://tttkmbb.com/math/polygon-area.md · JSON definition: https://tttkmbb.com/math/polygon-area.json
- MCP: server
https://tttkmbb.com/mcp, toolrun_calculator with calculator_id="polygon-area" - OpenAPI operationId:
calculate_polygon_area - Freshness:
static. Authentication: none. Rate limit: fair use (see rate limits).
Sources
- Wikipedia – Shoelace formula (reference)
- Wikipedia – Centroid – of a polygon (reference)
- Wolfram MathWorld – Polygon Area (reference)
FAQ
Does the vertex order matter?
The vertices must follow the boundary (either direction); listing them in a different order describes a different, possibly self-intersecting, polygon. Clockwise input only changes the sign of the signed area, which is reported as orientation.
Can I use latitude/longitude?
Only for small areas after projecting to metres (e.g. UTM); degrees of longitude are not the same length as degrees of latitude, so raw coordinates give wrong areas.
Related calculators
- Regular Polygon Calculator — Regular polygons from side length or radius.
- Triangle Area Calculator — Triangle area from sides, base and height or coordinates.
- Distance Between Two Points Calculator — Length of a single edge between two points.