Slope Calculator — Slope & Line Equation Between Two Points
Points & Actions
Slope: m = (y₂ − y₁) / (x₂ − x₁). If x₂ = x₁, the slope is undefined and the line is vertical: x = x₁.
Tip: Press Enter in any field to calculate.
Preview
Blue points show your inputs; the line extends infinitely through them. Axes/grid are illustrative.
Understanding Slope and Line Equations
The slope of a line tells you how quickly the line rises or falls as you move along the
x-axis. With two points P₁(x₁, y₁) and P₂(x₂, y₂), the slope is
m = (y₂ − y₁) / (x₂ − x₁). If m > 0, the line goes up from left to right; if
m < 0, it goes down. A slope of 0 means the line is perfectly horizontal.
When x₂ = x₁, the denominator becomes zero, so the slope is undefined and the line is
vertical with equation x = constant.
Why does this formula make sense? Imagine walking from P₁ to P₂. Your horizontal step
is Δx = x₂ − x₁ and your vertical step is Δy = y₂ − y₁. The ratio
Δy / Δx is simply “rise over run,” a compact measure of steepness. This same ratio holds for
every pair of points on a straight line.
Three Common Forms of a Line
-
Slope–intercept form:
y = m x + b. Herebis where the line crosses the y-axis (x = 0). If you know the slope and the intercept, this form is the quickest to sketch. -
Point–slope form:
y − y₁ = m(x − x₁). This is ideal when you know a single point on the line and the slope. Expand it to get the slope–intercept form if needed. -
Standard form:
Ax + By = C. Handy for integer coefficients and for expressing vertical lines (setB = 0to getx = C/A). It’s also convenient for solving line intersections with linear algebra.
Worked Example
Take P₁(−2, 1.5) and P₂(3, 4). Then
m = (4 − 1.5) / (3 − (−2)) = 2.5 / 5 = 0.5. Using P₁ in point–slope form:
y − 1.5 = 0.5(x − (−2)), which expands to y = 0.5x + 2.5. In standard form:
(4 − 1.5)x + (−2 − 3)y = (−2)·4 − 3·1.5 simplifies to 2.5x − 5y = −11.5. All three
equations describe the same line.
Angles, Units & Special Cases
The line’s inclination angle is θ = arctan(m) (in degrees in this tool). For a vertical line,
treat the angle as 90°. Units do not affect slope: if both axes are in metres, or both in
pixels, the ratio stays the same. If your axes use different units, convert first or your slope will be
mis-scaled. Duplicate points (P₁ = P₂) do not define a unique line—our calculator will prompt
you to change the inputs.
Tips for Students & Practitioners
- Check the sign: a quick sketch helps catch sign slips in
ΔyandΔx. - Prefer exact fractions when possible; decimals can hide nice rational slopes like
1/3or2/5. - For data analysis, slope corresponds to a constant rate of change (e.g., metres per second).
This calculator detects vertical lines automatically and outputs the appropriate form (e.g., x = a).
For non-vertical lines it reports slope, angle, and all three forms. Everything runs locally in your browser for
speed and privacy; copy LaTeX if you need to drop the result into notes or a report.