Triangle centroid calculator
Find the center of a triangle by averaging its corners: the vertices (0, 0), (6, 0) and (0, 6) give a centroid at (2, 2). It works even for flat triangles, as long as the three points differ. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- X1
- 0
- Y1
- 0
- X2
- 6
- Y2
- 0
- X3
- 0
- Y3
- 6
- Cx
- 2
- Cy
- 2
The centroid of a plane triangle is the single point obtained by averaging the coordinates of its three vertices. In school geometry it is also called the barycenter or center of mass of a uniform triangular plate: the three medians meet there, and each median is divided in a two-to-one ratio with the longer part toward the vertex. Engineers, CAD helpers, game developers, and contest solvers need that point as stable numbers they can pin in tests, not only a sketch on paper. This capacity accepts six numbers—x1, y1, x2, y2, x3, y3—checks that the three points are pairwise distinct, and returns the centroid as cx and cy together with an echo of the input vertices.
What the triangle centroid is and why people search for it
In Euclidean plane geometry the centroid G of triangle ABC is the arithmetic mean of the vertex coordinates: Gx equals (Ax plus Bx plus Cx) divided by three, and Gy equals (Ay plus By plus Cy) divided by three. Equivalently, G is the intersection of the three medians, and each median is split so that the segment from the vertex to G is twice the segment from G to the midpoint of the opposite side.
That point is the balance point of a thin triangular lamina of uniform density, which is why textbooks also call it the barycenter or center of mass. Search intent clusters around phrases such as triangle centroid calculator, barycenter of a triangle, average of three vertices, and find the center of a triangle from coordinates. Unlike circumcenter or orthocenter, the centroid formula never divides by a sine or a side length, so it remains well-defined for any three distinct points, including degenerate flat triangles that still have three different corners.
Practical use, limits, pricing, and delivery channels
Use the browser tool when you want an immediate centroid while checking homework, placing a label at the visual center of a triangle, or verifying a sketch without installing a computer-algebra system. Coordinates may be any finite numbers within a large absolute bound suitable for ordinary CAD and classroom figures; the response coordinates share the same unit system you already use. Results are fully deterministic: the same six numbers always yield the same cx and cy fields.
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. If you need area, circumcenter, incenter, or side lengths, use those dedicated landings when they exist—this capacity focuses solely on the centroid from three distinct points.
What you can do with it
Homework and exam centroid drills
Students and graders confirm cx and cy from three vertex coordinates without a local CAS, including rejection when two vertices coincide.
FAQ
What formula does the triangle centroid calculator use?
The centroid is the arithmetic mean of the vertices: cx = (x1 + x2 + x3) / 3 and cy = (y1 + y2 + y3) / 3.
Is the triangle centroid calculator free?
The browser tool runs free on your device.
Are collinear points accepted?
Yes, as long as the three points are pairwise distinct. The average of vertices remains defined for a flat (zero-area) triangle; only coincident vertices are rejected.
Where do the medians of a triangle meet?
At the centroid. Each median runs from a vertex to the midpoint of the opposite side, and the centroid splits it two to one, with the longer part toward the vertex.
What happens if two vertices are the same point?
The calculation is refused with a clear message, because fewer than three distinct points cannot form a triangle. Check that each of the three corners has its own coordinates.
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/triangle-centroid \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"x1":0,"y1":0,"x2":6,"y2":0,"x3":0,"y3":6}'const res = await fetch("https://api.kit.forhosting.com/geom/triangle-centroid", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"x1": 0,
"y1": 0,
"x2": 6,
"y2": 0,
"x3": 0,
"y3": 6
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/geom/triangle-centroid",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"x1": 0,
"y1": 0,
"x2": 6,
"y2": 0,
"x3": 0,
"y3": 6
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/geom/triangle-centroid", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"x1":0,"y1":0,"x2":6,"y2":0,"x3":0,"y3":6}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"x1":0,"y1":0,"x2":6,"y2":0,"x3":0,"y3":6}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/geom/triangle-centroid", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"x1": 0,
"y1": 0,
"x2": 6,
"y2": 0,
"x3": 0,
"y3": 6
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "geom.triangle_centroid",
"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
Collinear points still have a well-defined average and are accepted; coincident vertices fail immediately with invalid_input so failed validation is never charged.
What the triangle centroid is and why people search for it
Delivering cx and cy as JSON makes the result easy to diff in continuous integration, feed into a larger pipeline, or copy into notes.
How this calculator validates input and computes the average of vertices
Collinear but distinct points are allowed because the average of vertices is still defined and useful for labeling or as a fallback center. For accepted input the centroid is computed as cx equals (x1 plus x2 plus x3) divided by three and cy equals (y1 plus y2 plus y3) divided by three. Send a JSON body with the six required fields x1, y1, x2, y2, x3, and y3. Each field must be a finite number (JSON numbers or numeric strings are accepted). The engine rejects missing fields, empty strings, NaN, and infinities with invalid_input so those failed calls are not charged. After parsing, it checks pairwise distinctness: if vertex one coincides with vertex two, or one with three, or two with three within a tiny floating-point epsilon, the request fails with a clear message that fewer than three distinct points were supplied. That rule matches the geometric requirement for naming a triangle: you need three different corners. Results are rounded to a stable decimal precision so the same coordinates always yield the same JSON across JavaScript engines. The response echoes the six input coordinates, returns cx and cy, and sets method to average_of_vertices so callers can assert the algorithm in tests. There is no trigonometry, no matrix inversion, and no external geometry service—only addition and division by three on a Worker isolate.
Practical use, limits, pricing, and delivery channels
Each successful request is one billable item at $0.002; failed validation does not consume balance. Wire the endpoint into median demos, contest answer checkers, sprite anchor helpers, or preprocessing steps where you already prefer an explicit average of vertices over opaque black-box widgets that cannot explain why two coincident corners are rejected.
Integration use cases
Deterministic fixtures for geometry tests
Pipelines that seed unit tests or interactive median demos can call a pure centroid oracle instead of reimplementing the three-term average in every language.
CAD, mesh, and game label anchors
Tools that place text, collision origins, or UI markers at the visual center of a triangular face can recover the barycenter as structured JSON for import.
Technical questions
How do I compute a triangle centroid with this API?
Send a JSON body with x1, y1, x2, y2, x3, and y3 to geom.triangle_centroid. The response returns cx and cy as the average of the three vertices.
What happens if two vertices are the same point?
The request fails with invalid_input because fewer than three distinct points were supplied. Those validation failures are not charged.