Midpoint of a segment calculator
Enter both end points and get the exact center of the segment: from (0, 0) to (4, 6) the midpoint is (2, 3). It is also where the perpendicular bisector crosses the segment. 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
In coordinate algebra you find it by averaging: add the x-coordinates and divide by two, then do the same for y. That halfway point is also the center of the closed segment, the foot of the perpendicular bisector, and the balance point of a uniform rod along the segment. Students checking homework, contest solvers, game developers placing path anchors, CAD helpers, and survey assistants all need that center as stable numbers they can pin in tests—not only a sketch on paper.
How the halfway point is calculated
The midpoint of a segment is the one point that sits exactly halfway between its two end points. In plain terms you average the coordinates: add the two x values and halve the sum, then add the two y values and halve that sum. For the segment from (0, 0) to (4, 6), the x values add up to 4, and half of that is 2; the y values add up to 6, and half of that is 3. So the midpoint is (2, 3). The point found this way is equally far from both ends and lies on the line through them.
Where it helps and what to watch for
Students use it to check homework on segments and perpendicular bisectors, game and interface designers to place a label or an anchor at the visual center of an edge, and drafting or survey helpers to mark the center of a measured line. A common slip is to subtract the coordinates instead of adding them, which gives half the gap along each axis rather than a position. Another is mixing units, such as one end point in metres and the other in centimetres: the answer only makes sense when both end points use the same system. Every coordinate must be filled in with a finite number.
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.
FAQ
Is the midpoint of a segment 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 y-coordinates. For the end points (0, 0) and (4, 6) that gives (2, 3), the point exactly halfway between them.
What if both end points are the same point?
The midpoint is simply that shared point. The formula only averages coordinates and never divides by a length, so coincident end points are accepted and give a valid answer.
Which units does the result use?
The same units as your coordinates. If the end points are in metres, pixels or grid squares, the midpoint comes back in metres, pixels or grid squares, with no conversion.
Is the midpoint the same as the center of the segment?
Yes. The midpoint is the center of the closed segment, the point where its perpendicular bisector meets it, and the balance point of a uniform rod lying along it.
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/algebra/midpoint-of-segment \
-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/algebra/midpoint-of-segment", {
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/algebra/midpoint-of-segment",
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/algebra/midpoint-of-segment", 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/algebra/midpoint-of-segment", 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": "algebra.midpoint_of_segment",
"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 line segment is the unique point that sits exactly halfway between its two endpoints. 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 the midpoint of a segment is and why people search for it
In Euclidean plane algebra 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. Search intent clusters around phrases such as midpoint of a segment calculator, midpoint formula, halfway point between two coordinates, and find the center of a segment from endpoints. 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. Unlike distance or slope helpers, this landing focuses solely on the halfway coordinates obtained by averaging the endpoints of a line segment in the coordinate plane for classroom and engineering use.
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. Absolute values of coordinates beyond a large bound are rejected to keep floating-point results meaningful for ordinary figures. 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. 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 a line segment from its two endpoints in the coordinate plane.
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 algebra and 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 the midpoint of a segment with this API?
Send a JSON body with x1, y1, x2, and y2 to algebra.midpoint_of_segment. The response returns mx and my as the average of the two endpoints.
What formula does the midpoint of a segment 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.