Collinear points checker
(0, 0), (1, 2) and (2, 4) lie on one line with slope 2: enter three points and see whether they are collinear, with the triangle area, the shared slope or a vertical-line notice. 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
- 1
- Y2
- 2
- X3
- 2
- Y3
- 4
- Area
- 0
- Slope
- 2
Three points in the coordinate plane are collinear when a single straight line passes through every one of them. Algebra students, CAD validators, mapping pipelines, and exam graders constantly need a reliable yes-or-no answer for that property, plus the slope of the shared line when the answer is yes. This collinear points checker accepts the six Cartesian coordinates of points A, B, and C, computes the area of triangle ABC with the shoelace formula, and reports collinear when that area is numerically zero. When the points line up it also returns the common finite slope, or marks the line as vertical when the run is zero.
What collinear means and how a zero triangle area decides it
Two distinct points always determine a unique straight line. A third point either sits on that line or it does not. The fastest algebraic test does not compare pairwise slopes — those quotients blow up on vertical segments and become 0/0 when two vertices coincide.
Instead form triangle ABC and ask whether its area is zero. The shoelace formula (also called the surveyor's formula) gives twice the signed area as x1 times (y2 minus y3) plus x2 times (y3 minus y1) plus x3 times (y1 minus y2). Half the absolute value of that quantity is the ordinary area of the triangle.
If the absolute twice-area is numerically zero, the three vertices do not enclose any region and therefore lie on one line; if it is not zero they form a genuine triangle and cannot be collinear. Repeated points and two-point degeneracies still yield zero area, which correctly classifies them as collinear in the weak sense that some line (in fact infinitely many, when all three coincide) contains them. Units cancel in the comparison: metres, millimetres, or abstract classroom numbers all work as long as every coordinate uses the same scale.
When the points are collinear and at least two of them are distinct with a nonzero run, the response also reports the shared slope m equal to rise over run, taken from the distinct pair with the largest horizontal span so the quotient is as stable as the input allows.
What you enter and what you get back
Example: A at the origin, B at (1, 2), and C at (2, 4) are collinear with area zero and slope two, because each step doubles the y-increment of the x-increment. Move C to (2, 5) and the twice-area becomes one, the area becomes one half, collinear is false, and slope is omitted because there is no shared line. A vertical triple such as (1, 0), (1, 2), (1, 5) is collinear with vertical true and no finite slope key.
Pair the response with your own line-equation display if you need slope-intercept or standard form; this capability answers the collinearity question and reports the shared slope only.
Where a collinearity check helps
Coordinate-geometry classrooms and tutoring platforms use a collinear points checker so learners can verify whether three given vertices lie on one line without flipping a sign in the determinant by hand. CAD, GIS, and robotics pipelines constantly test whether a third waypoint still sits on a planned segment before they simplify a polyline or snap a constraint. Computer-graphics and game-level tools reject or flag handles that were meant to stay collinear when a designer nudges one vertex off the supporting line.
Failed validation does not consume balance. Keep requests small, pin the rounded area and slope in tests, and you get reproducible collinearity decisions for homework, CI geometry gates, and edge workers without standing up a full computational-geometry stack of your own.
What you can do with it
Classroom and homework checks
Let students submit three coordinate pairs and verify the collinear verdict plus the shared slope against the shoelace method taught in class.
Exam and LMS auto-grading
Mark items that ask whether three given points are collinear with a deterministic zero-area oracle that never invents a slope for a genuine triangle.
Polyline snap and CAD constraints
Test whether a third waypoint still sits on a planned segment before simplifying a path or accepting a collinear-handle constraint.
FAQ
How do I check if three points are collinear?
Send finite numbers x1, y1, x2, y2, x3, and y3.
What formula decides collinearity?
Twice the signed area is x1(y2−y3)+x2(y3−y1)+x3(y1−y2). The points are collinear if and only if the absolute value of that quantity is zero (within a tiny numeric epsilon).
When does the checker return a shared slope?
Only when the three points are collinear and at least two of them are distinct with a nonzero run. Then slope is rise over run from the distinct pair with the largest horizontal span. Vertical lines omit slope and set vertical true.
What happens if the three points form a vertical line?
They are collinear with area zero and vertical true. Slope is omitted because a vertical line has an undefined finite slope (the run is zero).
What if two of the points are the same?
Repeated points still give zero area, so they count as collinear: some line always passes through them. When all three points coincide, infinitely many lines do.
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/collinear-points-check \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"x1":0,"y1":0,"x2":1,"y2":2,"x3":2,"y3":4}'const res = await fetch("https://api.kit.forhosting.com/algebra/collinear-points-check", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"x1": 0,
"y1": 0,
"x2": 1,
"y2": 2,
"x3": 2,
"y3": 4
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/algebra/collinear-points-check",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"x1": 0,
"y1": 0,
"x2": 1,
"y2": 2,
"x3": 2,
"y3": 4
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/algebra/collinear-points-check", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"x1":0,"y1":0,"x2":1,"y2":2,"x3":2,"y3":4}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"x1":0,"y1":0,"x2":1,"y2":2,"x3":2,"y3":4}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/algebra/collinear-points-check", 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": 1,
"y2": 2,
"x3": 2,
"y3": 4
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "algebra.collinear_points_check",
"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
Missing or non-numeric coordinates fail with invalid_input so automation never mistakes garbage for geometry.
What collinear means and how a zero triangle area decides it
This endpoint uses a small absolute epsilon of one times ten to the minus nine so ordinary floating-point noise does not flip the boolean, while a clear lift of one point off the line still reports not collinear.
Input contract, response shape, and error behaviour
POST a JSON body with six required finite numbers: x1 and y1 for point A, x2 and y2 for B, and x3 and y3 for C. Each field may arrive as a JSON number or as a numeric string such as "1.5" or "-2e-3"; Infinity, NaN, empty strings, missing fields, and non-numeric text fail with invalid_input naming the offending field, and those failures are not billed. Common aliases such as ax, ay through cx, cy and p1x through p3y are accepted so spreadsheet-style and CAD-style payloads map cleanly. On success the body includes collinear as a boolean; area as the absolute shoelace area rounded to twelve decimal places (exactly zero when the points line up); slope as the shared finite slope, present only when the three points are collinear and the line is not vertical; vertical as a boolean that is true only for a collinear vertical line; the echoed coordinates; and formula restating the decision rule.
Where a three-point collinearity API earns its keep
Exam-prep generators and LMS plugins need a deterministic oracle that returns a boolean plus a slope they can print next to a worked solution, instead of a silent empty object that a buggy grader might treat as success.
Technical questions
What does the collinear points checker cost?
The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.