Polygon apothem calculator
Give the number of sides and one length you know, and the whole regular polygon comes back: a hexagon with sides of 2 has an apothem of 1.732051, an area of 10.392305 and a perimeter of 12. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Number of sides
- 6
- Side length
- 2
- Apothem
- 1.732051
- Circumradius
- 2
- Area
- 10.392305
- Perimeter
- 12
Computes the apothem and full geometry of a regular n-sided polygon. Supply the number of sides n plus exactly one of side length, circumradius R or apothem, and it returns apothem, side, R, area, perimeter and interior angle.
The apothem formula and how the polygon is solved
For a regular polygon with n equal sides of length s, the apothem is the perpendicular distance from the centre to the midpoint of a side, given by a = s / (2 · tan(π/n)). This capability accepts n together with exactly one of three size inputs and reconstructs the whole figure from it. Given the side, it derives a = s/(2·tan(π/n)) and the circumradius R = s/(2·sin(π/n)).
All three inputs are mutually consistent because they describe the same regular polygon, so you may start from whichever measurement you actually have on hand and receive the other two exactly.
Derived outputs: area, perimeter and interior angle
Once side and apothem are known, the tool returns the perimeter as perimeter = n·s and the area as area = (n · s · a) / 2, which is simply the polygon split into n congruent triangles of base s and height a. Every numeric field passes through a half-up rounding step controlled by the decimals parameter, defaulting to six decimal places and accepting 0 to 10.
Validation, ranges and edge cases
Inputs are checked strictly before any trigonometry runs. n must be an integer in the range 3 to 1000; a triangle is the smallest polygon and the upper bound keeps π/n well away from degenerate values. Whichever size value you pass must be a positive number, and decimals must be an integer from 0 to 10. As n grows the polygon approaches a circle, so apothem, R and side of a fixed-area shape converge; the code guards against non-finite results and rejects them rather than returning NaN.
What you can do with it
CAD and fabrication layout
Convert a known circumradius or side into the apothem to position bolt circles, mill flats or nut wrench sizes for regular hexagonal and octagonal parts.
Tiling and architecture
Get exact area and perimeter for regular-polygon floor tiles or pavilion plans from a single measured dimension, without re-deriving the trigonometry each time.
Geometry teaching and grading
Generate deterministic worked answers for n-gon problems, including the interior angle, to build answer keys or verify student submissions at scale.
FAQ
What is the apothem of a regular polygon?
It is the perpendicular distance from the centre to the midpoint of any side, equal to s / (2·tan(π/n)) for n sides of length s.
Which input should I provide?
Give n plus exactly one of side, R (circumradius) or apothem.
What ranges are allowed?
n is an integer from 3 to 1000, your size value must be positive, and decimals is an integer from 0 to 10 (default 6).
How is the area of a regular polygon worked out from the apothem?
Multiply the perimeter by the apothem and halve it, because the polygon splits into n equal triangles whose base is a side and whose height is the apothem. A hexagon with sides of 2 gives a perimeter of 12 and an area of 10.392305.
How do I get the apothem from the circumradius?
Multiply the circumradius by the cosine of π/n. For a hexagon with a circumradius of 2 the apothem is 1.732051, and the side equals the circumradius. Enter the circumradius instead of the side and this step is done for you.
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/math/polygon-apothem \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"n":6,"side":2}'const res = await fetch("https://api.kit.forhosting.com/math/polygon-apothem", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"n": 6,
"side": 2
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/math/polygon-apothem",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"n": 6,
"side": 2
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/math/polygon-apothem", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"n":6,"side":2}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"n":6,"side":2}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/math/polygon-apothem", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"n": 6,
"side": 2
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "math.polygon_apothem",
"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
The apothem formula and how the polygon is solved
Given R, it uses a = R·cos(π/n) and s = 2R·sin(π/n). Given the apothem, it inverts to s = 2a·tan(π/n) and R = a/cos(π/n).
Derived outputs: area, perimeter and interior angle
The interior angle at each vertex is reported in degrees as interior_angle_deg = ((n − 2) / n) · 180, so a hexagon gives 120° and a square gives 90°.
Validation, ranges and edge cases
You must provide exactly one of side, R or apothem: supplying none or more than one raises a typed invalid_input error reading "proporcione exactamente uno de side,R,apothem". All errors carry the invalid_input code so a form or automated client can react without parsing prose.
Technical questions
What outputs do I get back?
apothem, side, R, area = n·s·a/2, perimeter = n·s and interior_angle_deg = ((n−2)/n)·180, all rounded to your chosen decimals.
Is it free and how do I automate it?
The tier A widget runs free in your browser; for bulk or programmatic use the deterministic API returns the same JSON from $0.002 per call.