How it works
The slope calculator takes two points on a line and derives three key properties: the slope (or gradient), the angle of inclination, and the equation of the line itself. You input the coordinates of both points, and the tool computes how steeply the line rises or falls, what angle it makes with the horizontal, and the mathematical equation that describes it.
This is useful whenever you need to understand the steepness of a line, compare gradients, or write the equation of a line for further analysis or graphing.
The formula
slope (m) = (y₂ − y₁) / (x₂ − x₁)
Once you have the slope, the angle of inclination is found using the inverse tangent: angle = arctan(m), measured in degrees or radians. The line equation typically appears in two forms:
- Point-slope form:
y − y₁ = m(x − x₁) - Slope-intercept form:
y = mx + b, whereb = y₁ − m·x₁
Worked example
Suppose you have two points: (2, 3) and (5, 9).
Step 1: Calculate slope
m = (9 − 3) / (5 − 2) = 6 / 3 = 2
The slope is 2, meaning for every 1 unit you move right, the line rises 2 units.
Step 2: Find the angle
angle = arctan(2) ≈ 63.43°
The line is inclined at roughly 63 degrees above the horizontal.
Step 3: Write the line equation
Using point-slope form with point (2, 3):
y − 3 = 2(x − 2)
y − 3 = 2x − 4
y = 2x − 1 (slope-intercept form)
You can verify this: when x = 2, y = 2(2) − 1 = 3 ✓; when x = 5, y = 2(5) − 1 = 9 ✓
Common mistakes
Swapped coordinates: Make sure you're consistent about which point is (x₁, y₁) and which is (x₂, y₂). The order matters for the sign of the slope, though swapping both points will give the same result.
Vertical lines: If x₂ = x₁, you'll get division by zero—the slope is undefined. A vertical line has no finite slope; its angle is 90°.
Horizontal lines: If y₂ = y₁, the slope is zero and the line is horizontal (angle = 0°). This is valid and often a source of confusion, but it's correct.
Unit confusion: The angle is typically given in degrees, but some contexts use radians. Check your calculator's output or convert as needed (1 radian ≈ 57.3°).
Rounding the slope: If you round the slope prematurely before calculating the y-intercept (b), your line equation will be slightly off. Use the full precision of the slope in intermediate steps.
The slope calculator handles all these cases automatically, so you get accurate results every time. It's especially handy for graphing, comparing the steepness of different lines, or setting up linear equations in physics, economics, or engineering work.