Midpoint calculator
The midpoint of the segment from (0, 0) to (4, 6) is (2, 3): the average of the two x values and of the two y values. Enter both end points and get the halfway point in the same units. 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
- 4
- Y2
- 6
- Mx
- 2
- My
- 3
Engineers, CAD helpers, game developers, survey assistants, and contest solvers need that center as stable numbers they can pin in tests, not only a sketch on paper.
What the midpoint of a segment is
The midpoint of a segment is the single point that sits exactly halfway between its two end points. It is the center of the segment, the place where the perpendicular bisector meets it, and the balance point of a thin, uniform rod laid along it. Of all the points on the line through the two end points, it is the only one that is equally far from both. That is why it turns up in so many places: drawing the bisector of a side, finding the center of an edge in a sketch, or splitting a path into two equal halves.
How it is worked out, and when to use something else
The rule is an average. Add the two x values and divide by two, then add the two y values and divide by two. From (0, 0) to (4, 6), that gives (2, 3). No square roots are involved, so the result is exact for whole numbers and simple to check by hand. Use it to check homework, to place a label at the visual center of an edge, or to verify a sketch. If you need the length of the segment, its slope, the centroid of a triangle or a point at another ratio, those are different questions with their own formulas.
Practical use, limits, pricing, and delivery channels
Use the browser tool when you want an immediate midpoint while checking homework, placing a label at the visual center of an edge, 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 four numbers always yield the same mx and my 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 distance, slope, triangle centroid, or parametric section formula at a ratio other than one-to-one, use those dedicated landings when they exist—this capacity focuses solely on the midpoint of two plane points.
FAQ
Is the midpoint calculator free?
The browser tool runs free on your device.
What is the midpoint formula?
Add the two x coordinates and divide by two, then do the same with the two y coordinates. The result is the arithmetic mean of the end points, the one point on the segment that is the same distance from both ends.
Does it work with negative coordinates?
Yes. Any finite numbers are accepted, negative or decimal, as long as both points use the same unit. The midpoint comes back in that same unit system, whether it is centimetres on a drawing or tiles on a map.
How is the midpoint related to the perpendicular bisector?
The perpendicular bisector of a segment crosses it exactly at the midpoint, so the midpoint is the foot of that line. Every point on the bisector is equally far from the two end points, and the midpoint is the one lying on the segment itself.
Can I find a point one third of the way instead of halfway?
Not here: this calculator only finds the point that splits the segment one to one. For any other ratio you need a section formula, which weights the two end points differently.
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/midpoint \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"x1":0,"y1":0,"x2":4,"y2":6}'const res = await fetch("https://api.kit.forhosting.com/geom/midpoint", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"x1": 0,
"y1": 0,
"x2": 4,
"y2": 6
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/geom/midpoint",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"x1": 0,
"y1": 0,
"x2": 4,
"y2": 6
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/geom/midpoint", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"x1":0,"y1":0,"x2":4,"y2":6}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"x1":0,"y1":0,"x2":4,"y2":6}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/geom/midpoint", 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": 4,
"y2": 6
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "geom.midpoint",
"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 midpoint of a plane segment is the single point that sits halfway between its two endpoints. In school geometry it is the average of the endpoint coordinates: add the x-values and divide by two, then do the same for y. That point is also the center of the closed line segment, the foot of the perpendicular bisector, and the balance point of a uniform thin rod along the segment. This capacity accepts four numbers—x1, y1, x2, y2—checks that every coordinate is present and finite, and returns the midpoint as mx and my together with an echo of the input endpoints. Missing or empty fields fail immediately with invalid_input so failed validation is never charged.
What a segment midpoint is and why people search for it
Search intent clusters around phrases such as midpoint calculator, midpoint of two points, midpoint formula, and find the center of a segment from coordinates. Unlike distance or slope helpers, this landing focuses solely on the halfway coordinates of a segment. In Euclidean plane geometry the midpoint M of segment AB is the arithmetic mean of the endpoint coordinates: Mx equals (Ax plus Bx) divided by two, and My equals (Ay plus By) divided by two. Equivalently, M is the unique point on the line through A and B that is equidistant from both endpoints, and it is the center of the closed segment. Delivering mx and my as JSON makes the result easy to diff in continuous integration, feed into a larger pipeline, or copy into notes. The formula never divides by a length or a sine, so it remains well-defined for any two finite points, including coincident endpoints where the midpoint is simply that shared point.
How this calculator validates input and computes the average of endpoints
After parsing, the midpoint is computed as mx equals (x1 plus x2) divided by two and my equals (y1 plus y2) divided by two. Send a JSON body with the four required fields x1, y1, x2, and y2. 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. Results are rounded to a stable decimal precision so the same coordinates always yield the same JSON across JavaScript engines. The response echoes the four input coordinates, returns mx and my, and sets method to average_of_endpoints 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 two on a Worker isolate. Coincident endpoints are accepted because the average is still defined and equals that point; only incomplete or non-numeric coordinates are rejected.
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 path helpers, or preprocessing steps where you already prefer an explicit average of endpoints over opaque black-box widgets that cannot explain why a missing y2 is rejected.
Integration use cases
Homework and exam midpoint drills
Students and graders confirm mx and my from two endpoint coordinates without a local CAS, including rejection when any coordinate is missing.
Deterministic fixtures for geometry tests
Pipelines that seed unit tests or interactive segment demos can call a pure midpoint oracle instead of reimplementing the two-term average in every language.
CAD, mesh, and game path anchors
Tools that place text, collision origins, or UI markers at the visual center of an edge can recover the segment midpoint as structured JSON for import.
Technical questions
How do I compute a segment midpoint with this API?
Send a JSON body with x1, y1, x2, and y2 to geom.midpoint. The response returns mx and my as the average of the two endpoints.
What formula does the midpoint calculator use?
The midpoint is the arithmetic mean of the endpoints: mx = (x1 + x2) / 2 and my = (y1 + y2) / 2. The method field is always average_of_endpoints.
What happens if a coordinate is missing?
The request fails with invalid_input because a finite number is required for every field. Those validation failures are not charged.
Are coincident endpoints accepted?
Yes. If both endpoints are the same point, the midpoint equals that point. Only missing or non-finite coordinates are rejected.