Y-intercept of a line calculator
The line 2x − y + 6 = 0 crosses the y-axis at (0, 6): enter the three coefficients of the general form and get the intercept, or a clear notice when the line is vertical and never crosses. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- A
- 2
- B
- -1
- C
- 6
- Equation
- 2x - y + 6 = 0
- Y intercept
- 6
- Intercept x
- 0
- Intercept y
- 6
The y-intercept of a straight line is the unique point where the graph crosses the vertical axis, found by substituting x equals zero into the line equation and solving for y. Students, tutors, and automation scripts need that intercept quickly for graphing, checking slope-intercept form, and validating that a claimed b-value matches the general equation ax plus by plus c equals zero. This y-intercept of a line calculator accepts finite coefficients a, b, and c, sets x to zero, and returns the intercept y-value with the ordered pair (0, y) whenever the line is non-vertical. Degenerate coefficients where a and b are both zero are rejected as invalid input.
What the y-intercept is and how setting x to zero finds it
On the Cartesian plane every non-vertical straight line crosses the y-axis exactly once. That crossing is the y-intercept: the point whose first coordinate is zero and whose second coordinate is the height where the line meets the axis. Algebraically, if the line is written in general form ax plus by plus c equals zero, substitute x equals zero to obtain by plus c equals zero, then solve y equals negative c over b whenever b is not zero.
The same substitution works after rewriting slope-intercept form y equals mx plus k as mx minus y plus k equals zero, in which case the intercept is simply k. Vertical lines are the special case b equals zero with a not zero: the equation reduces to x equals negative c over a and never depends on y, so there is no finite y-intercept.
What you can do with it
Exam and LMS auto-grading
Mark y-intercept items with a deterministic oracle that rejects degenerate coefficients and flags vertical lines instead of inventing a y value.
Graphing and calibration scripts
Obtain the axis crossing of a general-form line in notebooks and previews without importing a full computer-algebra library.
FAQ
How do I find the y-intercept of 2x − y + 6 = 0?
Set x to zero, which leaves −y + 6 = 0, so y is 6. The line therefore crosses the vertical axis at the point (0, 6).
What is the formula for the y-intercept of a line in general form?
Substitute zero for x and solve what remains: the intercept is minus c divided by b. It only exists when b is not zero, because then the line is not vertical.
Why does a vertical line have no y-intercept?
When b is zero the equation no longer depends on y, so the line stays at one x value and runs parallel to the vertical axis. With a 1, b 0 and c −3 it is the line through x equals 3.
What happens if a and b are both zero?
The coefficients then describe no line at all, so the calculator rejects them instead of guessing. At least one of the two numbers in front of x or y must be different from zero.
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/y-intercept-of-line \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"a":2,"b":-1,"c":6}'const res = await fetch("https://api.kit.forhosting.com/algebra/y-intercept-of-line", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"a": 2,
"b": -1,
"c": 6
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/algebra/y-intercept-of-line",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"a": 2,
"b": -1,
"c": 6
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/algebra/y-intercept-of-line", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"a":2,"b":-1,"c":6}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"a":2,"b":-1,"c":6}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/algebra/y-intercept-of-line", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"a": 2,
"b": -1,
"c": 6
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "algebra.y_intercept_of_line",
"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
When b is zero the line is vertical and never meets the y-axis, so the response flags is_vertical without inventing a fake intercept.
What the y-intercept is and how setting x to zero finds it
This capability encodes that geometry directly: non-vertical lines receive has_y_intercept true with y_intercept and intercept_point filled in; vertical lines receive is_vertical true and has_y_intercept false without a fabricated y value.
Input contract, response fields, and vertical-line behaviour
Example: a equals two, b equals negative one, c equals six yields two x minus y plus six equals zero, which is the same as y equals two x plus six, so the y-intercept is six and the point is (0, 6). Example vertical: a equals one, b equals zero, c equals negative three yields the line x equals three with no y-intercept. Invalid input is not billed; successful parse calls use the published base price. POST a JSON body with three required finite numbers: a, the coefficient of x; b, the coefficient of y; and c, the constant term in ax plus by plus c equals zero. Each field may arrive as a JSON number or as a numeric string; missing fields, empty strings, and non-finite values fail with invalid_input naming the field. If a and b are both zero the request fails because the coefficients do not define a line. On success the body always echoes a, b, and c, an equation display string, boolean is_vertical, boolean has_y_intercept, and a short formula string documenting the substitution. When the line is non-vertical (b not zero) the body also includes y_intercept, intercept_x equal to zero, intercept_y, and intercept_point as a parenthesised pair such as (0, 6). When the line is vertical (b equals zero and a not zero) those intercept fields are omitted and vertical_x is set to the constant x-value of the line. Optional fields are never sent as null: clients should branch on has_y_intercept or is_vertical.
Where a y-intercept of a line API earns its keep
Algebra classrooms and tutoring platforms use a y-intercept calculator so learners can check textbook answers for general-form and slope-intercept problems without sign errors when rearranging ax plus by plus c equals zero. Exam generators and LMS plugins need a deterministic oracle that marks vertical lines as having no intercept instead of silently returning zero or NaN that a buggy grader might accept. Failed validation does not consume balance. Graphing previews, CAD sketches, and sensor-calibration notebooks often need the axis crossing of a fitted line before drawing; calling a tiny parse API avoids pulling a full computer-algebra system for three coefficients.
Integration use cases
Classroom and homework checks
Students enter a, b, and c for ax+by+c=0 and verify the y-intercept point (0, y) or confirm the line is vertical with no intercept.
Technical questions
How do I find the y-intercept of a line from ax + by + c = 0?
Send finite coefficients a, b, and c. The API sets x=0 and returns y=-c/b with the point (0, y) when b≠0. Vertical lines (b=0) are flagged with has_y_intercept false.
What happens for a vertical line?
When b=0 and a≠0 the line is x=-c/a. The response sets is_vertical true and has_y_intercept false, includes vertical_x, and omits y_intercept fields rather than inventing a value.
Why are a and b both zero rejected?
If a=0 and b=0, ax+by+c=0 is not a line (it is either never true or always true depending on c). The task fails with invalid_input and is not billed.
Can I use slope-intercept form y = mx + k?
Yes: rewrite as mx − y + k = 0, so a=m, b=−1, c=k. The returned y_intercept equals k for any finite slope m.
What does the y-intercept of a line calculator cost?
The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.