Angle in disguise
Slope is just \(\tan θ\). If you know the angle of a roof or ramp, its slope is the tangent—no extra formulas needed.
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.
Blue points show your inputs; the line extends infinitely through them. Axes/grid are illustrative.
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.
y = m x + b. Here b is where the line
crosses the y-axis (x = 0). If you know the slope and the intercept, this form is the quickest
to sketch.
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.
Ax + By = C. Handy for integer coefficients and for expressing
vertical lines (set B = 0 to get x = C/A). It’s also convenient for solving line
intersections with linear algebra.
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.
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.
Δy and Δx.1/3 or 2/5.
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.
Slope is just \(\tan θ\). If you know the angle of a roof or ramp, its slope is the tangent—no extra formulas needed.
As long as x and y share units, slope is unitless. Feet, metres, pixels—it all divides out. Mixed units break it fast.
Two non-vertical lines are parallel iff their slopes are equal. For perpendicular, multiply the slopes: you get -1 (negative reciprocal).
Train tracks keep slopes under about 2% (\(m = 0.02\)) so locomotives can climb without stalling. Slope shows up in engineering limits everywhere.
As x₂ → x₁, Δx → 0 and slope shoots toward infinity. That’s why vertical lines ditch m and use x = constant instead.