Coordinate Geometry Calculator
Find the key properties of the straight line through two points on the plane. Enter (x₁, y₁) and (x₂, y₂) to get the slope (gradient), y-intercept, midpoint and the line's equation in y = mx + b form.
Enter Values
How to use this calculator
- Enter the coordinates of the first point as x₁ and y₁ (negatives allowed).
- Enter the coordinates of the second point as x₂ and y₂.
- Read the slope, y-intercept, midpoint and the line equation; a vertical line is flagged as an undefined slope.
How it works
The slope (gradient) is the rise over run: m = (y₂ − y₁) ÷ (x₂ − x₁). Substituting one point into y = mx + b gives the y-intercept b = y₁ − m·x₁, so the full line equation is y = mx + b. The midpoint is the coordinate-wise average, ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2). When x₁ equals x₂ the run is zero, so the slope is undefined; the calculator reports the line as vertical with the equation x = constant instead of dividing by zero.
Worked example
Worked example. For the points (1, 2) and (4, 8): the slope is (8 − 2) ÷ (4 − 1) = 6 ÷ 3 = 2, and the y-intercept is 2 − 2 × 1 = 0, giving the equation y = 2x + 0. The midpoint is ((1 + 4) ÷ 2, (2 + 8) ÷ 2) = (2.5, 5).
Common mistakes
- Swapping x and y when reading a coordinate — the order is (x, y), horizontal first.
- Expecting a slope for a vertical line; when x₁ = x₂ the slope is genuinely undefined, not zero.
- Confusing a horizontal line (slope 0) with a vertical line (undefined slope) — a slope of 0 means y is constant, not x.
Frequently asked questions
What happens when the two x-values are the same?
The line is vertical, so its slope is undefined (the run x₂ − x₁ is zero). The calculator flags this and reports the equation as x = constant rather than dividing by zero.
How is the y-intercept found?
Once the slope m is known, substitute one point into y = mx + b and rearrange: b = y₁ − m·x₁. It is the y-value where the line crosses the y-axis (x = 0).
Related tools
- Polygon Interior Angle Calculator
- Triangle Solver (SSS)
- Distance Formula Calculator
- Inverse Trig (arcsin, arccos, arctan) Calculator
- Line Intersection Calculator
- Circle Equation Calculator
Explore more in Maths, Education & Science.
Tip: Enter any known values to calculate the remaining results.
All calculations run in your browser. Your inputs are never saved or transmitted.



