Slope calculator: find slope and line equation from two points
The slope of a line describes its steepness and direction. Given any two points on a coordinate plane, a slope calculator finds the slope, y-intercept, angle of inclination, straight-line distance between the points, and the full equation of the line in slope-intercept form.
Slope, y-intercept, and line equation
Slope is defined as the rise divided by the run: the change in y divided by the change in x between two points. 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 horizontal. A vertical line has an undefined slope because the change in x is zero and division by zero is undefined.
The y-intercept is the value of y when x equals zero, found by rearranging the slope formula: b = y1 - m*x1. The slope-intercept form of the line equation is y = mx + b. This form is the most common way to write a linear equation because the slope and y-intercept can be read directly from the equation.
m = (y2 - y1) / (x2 - x1)
Slope equals the vertical change (rise) divided by the horizontal change (run) between two points.
b = y1 - (m × x1)
The y-intercept is found by substituting one known point and the slope into the rearranged line equation.
d = sqrt((x2 - x1)^2 + (y2 - y1)^2)
The straight-line distance between two points is calculated using the Pythagorean theorem.
angle = arctan(m) x (180 / pi)
The angle the line makes with the positive x-axis in degrees, derived from the inverse tangent of the slope.
Applications of slope in science and engineering
In physics, slope represents rate of change. The slope of a position-time graph is velocity, and the slope of a velocity-time graph is acceleration. In economics, the slope of a supply or demand curve shows how quantity changes when price changes. In statistics, the slope of a regression line shows the average change in one variable for each unit increase in another.
In construction and civil engineering, slope is often written as a ratio, gradient, or percentage grade. A 5% road grade means a rise of 5 metres for every 100 metres of horizontal distance, which is equivalent to a slope of 0.05. This makes a slope calculator useful not just as a maths calculator online, but also as a practical calculator for design, drainage, surveying, and access planning.
Wikipedia: Slope — Mathematical definition of slope and its applications in geometry, calculus, and engineering.
Worked example and interpretation
A worked example helps translate the slope calculator maths into a realistic scenario so the user can compare the headline result with a concrete set of inputs.
That matters because a result is easier to trust when the page shows how the same logic behaves in a practical case instead of leaving the formula abstract.
Frequently asked questions
What is slope and how is it calculated?
Slope (gradient) measures how steep a line is and equals rise over run: the change in the y-coordinate divided by the change in the x-coordinate between two points. Slope = (y₂ - y₁) / (x₂ - x₁). A slope of 1 means the line rises 1 unit for every 1 unit it moves right.
What does a negative slope mean?
A negative slope means the line falls as it moves left to right. A slope of -2 means the line drops 2 units for every 1 unit moved to the right. A slope of zero means the line is horizontal; an undefined slope (division by zero) means the line is vertical.
What is the equation of a straight line and how does slope relate to it?
The slope-intercept form is y = mx + b, where m is the slope and b is the y-intercept (the value of y where the line crosses the y-axis). Given the slope and any point on the line, or given two points, you can find the full equation of the line.
Guides
Featured in articles
Step-by-step guides that use this calculator to solve real problems.