Regular polygon diagonal lengths
Enter the number of sides and the circumradius of a regular polygon and get each distinct diagonal length: a hexagon with a radius of 1 has 6 short diagonals of about 1.7320508076 and 3 long ones of 2. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Sides
- 6
- Circumradius
- 1
- Side length
- 1
- Diagonal count
- 9
- Distinct count
- 2
- Lengths
- 1.7320508076, 2
A regular polygon with four or more sides has diagonals: line segments that join non-adjacent vertices. When the figure is regular, every vertex lies on a common circle, so each diagonal is a chord of that circumcircle. The chord length depends only on the circumradius R and how many sides the chord spans. With integer side count n and positive R fixed, the formula two R times sine of k pi over n yields every distinct diagonal length for spans k from two through floor of n over two. Students use these lengths when studying regular pentagons, hexagons, and higher polygons in geometry courses. Designers and makers need them when a bolt circle, tile layout, or frame is specified by n and R alone.
What regular-polygon diagonals are and why length differs from count
In a convex n-gon a diagonal joins two vertices that are not consecutive along the boundary. The classic count formula n times n minus three over two tells you how many such segments exist, but it says nothing about their lengths. For an irregular polygon those lengths can all differ; for a regular polygon the symmetry group collapses them into only a few distinct values.
Place the n vertices equally spaced on a circle of radius R. Number them zero through n minus one. The Euclidean distance between vertex zero and vertex k, with k between one and floor of n over two, is exactly the chord length two R sine of k pi over n.
When k equals one that chord is a side. When k is at least two it is a diagonal. Each integer k in two through floor of n over two therefore labels one distinct diagonal length class.
A square has a single class: the two equal diagonals that are also diameters of the circumcircle. A regular hexagon has two classes: shorter diagonals that span two sides and longer diagonals that are diameters. A regular octagon has three classes, and the pattern continues.
Search intent clusters around regular polygon diagonal length calculator, diagonal of a regular polygon from radius, and distinct diagonals of a regular n-gon. People want numeric lengths they can check against a textbook, a CAD sketch, or a cut list—not only the integer count of diagonals.
What you can do with it
Homework on regular-polygon diagonal lengths
Students and graders confirm every distinct diagonal length for squares through dodecagons given n and circumradius, including rejection when the side count is below four.
FAQ
What happens if sides is below 4?
A triangle has no diagonals; digons and monogons are also rejected. Those calls are not charged.
Is the regular polygon diagonal length calculator free?
The browser tool runs free on your device.
How many distinct diagonal lengths does a regular n-gon have?
Exactly ⌊n/2⌋ − 1 distinct lengths: one for each span k from 2 through ⌊n/2⌋. A square has one, a hexagon has two, an octagon has three, and so on.
How long are the diagonals of a regular hexagon?
With a circumradius of 1, the six shorter diagonals measure about 1.7320508076 and the three longer ones measure 2. The longer ones pass through the center, so they are diameters of the circle.
How is each diagonal length worked out?
Each diagonal is a chord of the circle through the corners. Its length is twice the radius times the sine of k times π over n, where k is how many sides the diagonal spans.
Related tools
For developers — API access
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.
API endpoint
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.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/geom/regular-polygon-diagonal \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"sides":6,"circumradius":1}'const res = await fetch("https://api.kit.forhosting.com/geom/regular-polygon-diagonal", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"sides": 6,
"circumradius": 1
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/geom/regular-polygon-diagonal",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"sides": 6,
"circumradius": 1
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/geom/regular-polygon-diagonal", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"sides":6,"circumradius":1}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"sides":6,"circumradius":1}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/geom/regular-polygon-diagonal", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"sides": 6,
"circumradius": 1
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "geom.regular_polygon_diagonal",
"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.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
This capacity accepts n at least four and a positive circumradius, rejects triangles and non-positive radii, and returns side length, total diagonal count, distinct lengths with multiplicities, and a stable formula string as structured JSON.
What regular-polygon diagonals are and why length differs from count
Delivering sides, circumradius, side_length, diagonal_count, distinct_count, a diagonals array with span length and multiplicity, and a lengths array as JSON makes the result easy to paste into notes, diff in automated tests, or feed into a larger pipeline without reimplementing trigonometric chord formulas in every language you teach or deploy.
How this calculator validates input and applies the chord formula
After validation the engine computes the side length as two R sine of pi over n, the total diagonal count as n times n minus three over two, and then loops span k from two through floor of n over two. For each span it evaluates length equals two R sine of k pi over n and records multiplicity: n diagonals for each non-diameter class, and n over two when n is even and k equals n over two because each diameter is shared by two opposite vertices. Edge cases are explicit: sides equal to three, two, or one; zero or negative circumradius; non-numeric strings; missing fields; and non-integer side counts all fail before any length is returned. Send a JSON body with sides and circumradius. sides must be an integer at least four; values below four fail with invalid_input because a triangle has no diagonals under this contract, and digons or monogons are not Euclidean regular polygons here. circumradius must be a positive finite number representing the distance from the center to any vertex. Results are rounded to a stable decimal precision so the same input always yields the same JSON across JavaScript engines. You may use any length unit for circumradius; side_length and every diagonal length are expressed in that same unit system so a radius of two meters produces diagonal lengths in meters without unit conversion inside the engine.
Practical use, limits, pricing, and delivery channels
Use the browser tool when you want immediate distinct diagonal lengths while checking homework on regular pentagons and hexagons, sizing a bolt circle from radius and side count, verifying a workshop drawing, or confirming a tile layout without installing a computer-algebra system. There is no language model, no external geometry service, and no randomness, so the capacity is safe to pin in continuous-integration checks and reproducible lesson materials. Each successful request is one billable item at $0.002; failed validation does not consume balance. Accepted inputs must satisfy sides greater than or equal to four and a strictly positive circumradius; triangles, digons, monogons, and non-positive radii are rejected with a clear invalid_input message. Results are fully deterministic: the same sides and circumradius always yield the same side_length, diagonal_count, distinct_count, diagonals array, and lengths array. Wire the endpoint into polygon drills that ask for diagonal lengths rather than only counts, contest answer checkers, manufacturing worksheets that list n and R, or floating preprocessing steps where you already prefer explicit domain errors over opaque black-box widgets that cannot show why sides below four are rejected.
Integration use cases
Deterministic fixtures for geometry tests
Pipelines that seed unit tests or interactive polygon demos can call a pure diagonal-length oracle instead of reimplementing chord formulas in every language.
Bolt circles and frames from n and R
Shop or design notes that specify a regular n-gon by side count and circumradius recover all distinct diagonal lengths as structured JSON for reports, cut lists, or lightweight CAD helpers.
Technical questions
How do I compute regular polygon diagonal lengths with this API?
Send a JSON body with sides (integer ≥ 4) and circumradius (positive number) to geom.regular_polygon_diagonal. The response returns side_length, diagonal_count, distinct_count, diagonals with span/length/multiplicity, and lengths.
Which formula does the calculator use?
Each diagonal of span k is d_k = 2·R·sin(k·π/n) for k = 2 … ⌊n/2⌋. The side length uses the same chord formula with k = 1. Total diagonal count is n(n−3)/2.