Slope Calculator – Gradient, Angle, and Line Equation
The slope of a line (also called gradient) measures how steeply a straight line rises or falls between two points on a coordinate plane. This calculator accepts two coordinate pairs and instantly computes the slope, the full slope-intercept equation, the angle of inclination, the percent grade, and whether a third optional point is collinear with the first two.
The Slope Formula
Given two points P₁(x₁, y₁) and P₂(x₂, y₂), the slope m is defined as:
m = (y₂ − y₁) / (x₂ − x₁) = rise / run
The numerator y₂ − y₁ is the rise — the vertical change between the two points. The denominator x₂ − x₁ is the run— the horizontal change. Together they form the familiar rise-over-run ratio.
A positive slope means the line rises from left to right. A negative slope means it falls. A slope of zero means the line is perfectly horizontal, and when x₁ = x₂ the slope is undefined because division by zero is not possible — the line is vertical.
Slope-Intercept Form of a Line
Once the slope is known, the full line equation can be derived. The most common form is the slope-intercept form:
y = mx + b
where m is the slope and b is the y-intercept— the point where the line crosses the y-axis. The y-intercept is calculated as:
b = y₁ − m × x₁
This form is the most versatile because it lets you find y for any value of x by simple substitution.
Angle of Inclination
The angle of inclination θ is the angle the line makes with the positive x-axis, measured counterclockwise in degrees:
θ = arctan(m) × (180 / π)
Results range from −90° (a nearly vertical falling line) to +90° (a nearly vertical rising line). A slope of 1 produces an angle of exactly 45°. A slope of 0 gives 0° (horizontal). The angle is useful in trigonometry, physics (ramp problems), and surveying.
Percent Grade
Percent grade expresses slope as a percentage, commonly used in road design, ramp engineering, and construction:
grade (%) = m × 100
A slope of 0.08 equals an 8% grade: the road rises 8 metres for every 100 metres of horizontal distance. Building codes for accessible ramps typically cap the grade at 8.33% (1:12 ratio). Highway design guidelines generally target grades below 6–8% for safety at speed.
Parallel and Perpendicular Lines
Two lines are parallel if and only if their slopes are equal. They are perpendicular if their slopes multiply to −1. Given slope m, the perpendicular slope is −1 / m. The calculator displays the perpendicular slope so you can immediately check or construct a right-angle intersection.
Collinearity of Three Points
Three points are collinear (they lie on the same straight line) when the area of the triangle they would form equals zero. The calculator checks this using the signed triangle area formula:
Area × 2 = x₁(y₂ − y₃) + x₂(y₃ − y₁) + x₃(y₁ − y₂)
If this value is zero (within a floating-point tolerance of 1 × 10⁻⁹), the three points are collinear. Enter optional coordinates for a third point to activate this check.
Slope as a Fraction
When the slope is not a whole number, the calculator also displays the slope as a reduced fraction. For example, a slope of 0.75 appears as 3/4. Fractional representation is produced by applying the Euclidean GCD algorithm to the rise and run values and reducing to lowest terms. This is particularly helpful in algebra and geometry classes where fractional slopes are preferred.
How to Use the Calculator
Enter the x and y coordinates for Point 1 and Point 2. Results update instantly as you type — no button press required. The coordinate diagram shows the two points, the line through them, and the rise/run triangle to help visualise the gradient. Use the optional third point fields to check collinearity. Click Show Step-by-Step to reveal the full substituted formula, and use the copy buttons next to each result to copy individual values to your clipboard.
Common Applications
Slope calculations appear in algebra courses (graphing linear equations), calculus (instantaneous rate of change as a limit), physics (velocity from position-time graphs, incline angle), civil engineering (road grades, drainage design), construction (roof pitch, accessible ramp design), anddata science (linear regression coefficients). Understanding slope is foundational to virtually every branch of mathematics and applied science.