Math
Slope Calculator
Enter two points to get the slope, line equation, distance, midpoint, and angle of inclination.
Point 1 (x1, y1)
Point 2 (x2, y2)
Slope
Slope (m)
—
Percent Grade
—
Ratio (rise:run)
—
Angle of Inclination
—
Line Equation
Slope-Intercept Form
—
Segment
Distance
—
Midpoint
—
Formulas
Slope (m)
(y2 − y1) / (x2 − x1)
Rise over run between two points
Line Equation
y = mx + b, where b = y1 − m·x1
Slope-intercept form of the line
Distance
√[(x2−x1)² + (y2−y1)²]
Straight-line distance between the points
Midpoint
((x1+x2)/2, (y1+y2)/2)
Point exactly halfway between the two points
Angle of Inclination
θ = atan(m)
Angle the line makes with the x-axis, in degrees
Percent Grade
m × 100
Slope expressed as rise per 100 units of run
Reading the Slope
Positive slope
The line rises from left to right — as x increases, y increases too.
Negative slope
The line falls from left to right — as x increases, y decreases.
Zero slope
A perfectly horizontal line — y never changes.
Undefined slope: a perfectly vertical line, where x never changes and rise/run divides by zero.
Real-World Uses
Road grades: Highway signs post percent grade — a 6% grade rises 6 feet per 100 feet of travel, about 3.43°.
Roof pitch: Roofers describe slope as a ratio like 4:12 — 4 inches of rise per 12 inches of run.
Drainage: Site plans need a minimum slope (often 1–2%) so water flows away from foundations instead of pooling.
FAQ
Frequently asked questions.
How do I calculate the slope of a line?
To calculate slope, pick two points on the line, (x1, y1) and (x2, y2), and divide the change in y by the change in x: m = (y2 − y1) / (x2 − x1). This is often remembered as 'rise over run' — rise is the vertical change, run is the horizontal change. For example, with points (1, 2) and (4, 8), the slope is (8 − 2) / (4 − 1) = 6 / 3 = 2, meaning the line rises 2 units for every 1 unit it runs to the right.
What does a slope of 0 mean, and what does an undefined slope mean?
A slope of 0 means the line is perfectly horizontal — y stays the same no matter how x changes, because the numerator (y2 − y1) is zero. An undefined slope means the line is perfectly vertical — x stays the same as y changes, so the denominator (x2 − x1) is zero and division by zero is undefined. Vertical lines cannot be written in the form y = mx + b; they are instead expressed as x = constant.
How do I convert slope to a percent grade?
To convert a slope to a percent grade, multiply the slope (rise/run) by 100. A slope of 0.06 becomes a 6% grade, and a slope of 0.02 becomes a 2% grade. Percent grade is the standard way road signs, trail maps, and construction plans express steepness, since it directly states how many units of vertical rise occur per 100 units of horizontal distance.
How do I convert slope to degrees or an angle of inclination?
To convert a slope to an angle, take the arctangent (inverse tangent) of the slope value: θ = atan(m), then convert the result from radians to degrees. For example, a slope of 2 corresponds to atan(2) ≈ 63.43°. This angle measures how steeply the line tilts relative to the horizontal x-axis, with 0° being flat and 90° being vertical.
What is the difference between a positive and a negative slope?
A positive slope means the line rises as it moves from left to right — as x increases, y also increases. A negative slope means the line falls from left to right — as x increases, y decreases. The steeper the absolute value of the slope, the more dramatic the rise or fall; a slope near zero indicates a nearly flat line in either direction.
How steep is a 6% slope, and how is slope used for road grades or roof pitch?
A 6% slope (or 6% grade) rises 6 feet for every 100 feet of horizontal distance, which corresponds to an angle of about 3.43° — noticeable but still fairly gentle, similar to many highway grades. Road engineers use percent grade to design safe inclines, drainage plans use slope to ensure water flows away from structures, and roofers use a rise-over-run ratio (like 4:12) to describe roof pitch. This calculator converts between all of these formats — decimal slope, percent grade, ratio, and angle — automatically.
Last updated: August 17, 2026