ForHosting KIT · Math

Polygon perimeter from coordinates

Enter the corners of a polygon in order and get the length of its boundary: the rectangle (0, 0), (3, 0), (3, 4), (0, 4) has a perimeter of 14, closing edge included, and each edge is listed. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon

Runs in your browser. Free, unlimited — your data never leaves this page.

When you already know the ordered vertices of a polygon on the Cartesian plane, the perimeter is simply the sum of the straight-line distances between consecutive corners, plus the final segment that closes the figure back to the starting point.

How the closed edge-sum recovers polygon perimeter

Label the ordered vertices as p0, p1, through p(n−1) with n at least two. The Euclidean length of the edge from pi to p(i+1) is the square root of the sum of squared differences in x and y, which is exactly what Math.hypot computes in one stable call. The closed perimeter is the sum of those lengths for every consecutive pair, plus the length of the closing edge from the last vertex back to the first.

That last segment is what distinguishes a closed polygon boundary from an open polyline; without it you would only have a path length, not the fence around the figure. Classic classroom checks include the axis-aligned rectangle with corners at (0, 0), (3, 0), (3, 4), and (0, 4), which produces perimeter fourteen, and the right triangle (0, 0), (4, 0), (0, 3), whose sides three, four, and five sum to twelve.

Because the algorithm uses only subtraction, hypot, and addition, it is deterministic, O(n) in the number of vertices, and free of trigonometric libraries or iterative solvers.

What you send and what you get back

Each entry must be either an object with finite x and y properties or a two-element array [x, y]. Missing fields, empty strings, non-numeric text, NaN, and Infinity on any coordinate are rejected and are not charged. After parsing, the service walks the ring once, accumulates each edge length with hypot, and checks that the total perimeter is a finite number.

Example checks: the unit-scaled rectangle above yields perimeter fourteen with four edges of lengths three, four, three, and four; a two-point segment (0, 0) and (3, 4) yields perimeter ten because the closed walk goes forth and back; a one-point list fails. Wire the free browser tool for quick sanity checks, then call the identical contract from scripts when you need bulk evaluation of coordinate-based perimeters without reimplementing the closed-ring walk in every language.

Where polygon perimeter calculations show up in real work

Secondary-school and college analytic geometry courses constantly ask students to find the perimeter of a polygon given plotted vertices; a trusted calculator with a strict two-point minimum and explicit closing edge speeds homework grading and removes spreadsheet mistakes where someone forgets the last side or double-counts a repeated first vertex.

Drafting, surveying, and simple GIS workflows that already project points into a local Cartesian plane need the planar fence length of multi-corner parcels before staking or reporting—having a shared numeric oracle keeps field notes and office scripts aligned on the same edge-sum path. Game, graphics, and CAD tutorials often store collision hulls and floor plans as ordered point lists; the perimeter answer feeds material estimates, path costs, and level-of-detail heuristics without building a full computational-geometry stack.

If you later need polygon area via shoelace, geodesic lengths on a globe, or open polyline path length without closing, treat those as separate search intents rather than overloading this polygon-perimeter landing.

Homework and exam checks

Compute polygon perimeter from ordered plotted vertices and reject lists with fewer than two points with a clear error.

Local-plane survey fences

From projected corner coordinates of a parcel, recover planar perimeter before reporting or fencing a multi-sided lot.

What formula does this calculator use?

Closed edge sum: perimeter = Σ Euclidean distances between consecutive vertices, plus the edge from the last vertex back to the first.

What happens if I send fewer than two points?

A polygon perimeter needs at least two vertices so at least one edge (and its closing return) can be measured.

Is the polygon treated as closed?

Yes. The walk always includes the closing edge from the last point to the first. For two points that means twice the segment length.

What point formats are accepted?

Each vertex may be an object {x, y} or a pair [x, y]. The list field may be named points, vertices, or coords.

What does it cost?

The browser tool is free and runs locally.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/geom/polygon-perimeter

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/geom/polygon-perimeter \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"points":[{"x":0,"y":0},{"x":3,"y":0},{"x":3,"y":4},{"x":0,"y":4}]}'
{
  "points": [
    {
      "x": 0,
      "y": 0
    },
    {
      "x": 3,
      "y": 0
    },
    {
      "x": 3,
      "y": 4
    },
    {
      "x": 0,
      "y": 4
    }
  ]
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "geom.polygon_perimeter",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

This calculator takes a list of points as {x, y} objects or [x, y] pairs, validates that at least two finite vertices are present, and returns the non-negative perimeter together with the normalized vertex list, each edge length, the vertex count, and a method tag of edge_sum. Requests with fewer than two points are rejected with a clear invalid_input error instead of a silent zero that looks like a successful solve. No network calls, no random sampling, and no floating-point surprises beyond ordinary IEEE-754 arithmetic on the coordinates you provide.

How the closed edge-sum recovers polygon perimeter

Large coordinates can still overflow IEEE-754 double range; when an intermediate edge length is non-finite the request fails with a clear overflow message instead of returning Infinity in JSON. That closed path matches how survey courses, analytic geometry textbooks, and computational geometry primers present the planar polygon perimeter problem, and it keeps automated graders and pipelines aligned with hand computation.

What you send and what you get back

Provide one required array field named points (aliases vertices and coords are accepted). At least two vertices are mandatory; a single point or an empty list fails with invalid_input naming the two-point rule. On success the JSON response returns perimeter rounded for stable serialization, n as the vertex count, points as the normalized list of {x, y} pairs, edges as the array of per-edge lengths in walk order including the closing edge last, and method set to the string edge_sum so logs and teaching UIs can document the algorithm. API pricing is the published base of $0.002 per successful item.

Where polygon perimeter calculations show up in real work

Because this capability is a pure parse engine, failed validation does not consume balance and successful runs stay at $0.002 per item.

Game and CAD hull helpers

Turn an ordered 2D vertex list into a closed perimeter for path costs and material estimates, same path in browser and API.

Read the full KIT documentation →