
What the Slope Calculator does
This slope calculator takes two points on a line and returns the slope, the equation of the line, the y-intercept, the angle, the percent grade, the distance between the points and the midpoint. It also shows the rise and run so you can check your homework or a design measurement step by step. It handles negative numbers and decimals, flags a vertical line as undefined, and runs entirely in your browser without storing anything.
How to use it
Type the coordinates of the first point into x1 and y1, then the second point into x2 and y2. Click Calculate. The headline result shows the slope m and the line in y = mx + b form. Below it you will see the rise (y2 minus y1), the run (x2 minus x1), the intercept, the angle in degrees, the percent grade, the distance and the midpoint. Reset restores the example values. The order of the points does not matter, because swapping them flips the sign of both rise and run and the slope stays the same.
Worked example
Take the points (1, 3) and (4, 9). The rise is 9 minus 3, which is 6. The run is 4 minus 1, which is 3. The slope is 6 divided by 3, so m = 2. To find the intercept, use b = y1 minus m times x1, which is 3 minus 2 times 1, so b = 1. The line is y = 2x + 1. The angle is the arctangent of 2, about 63.43 degrees, and the percent grade is 200 percent. The distance is the square root of 3 squared plus 6 squared, which is the square root of 45, about 6.7082. The midpoint is (2.5, 6).
Now try a falling line through (-2, 5) and (3, -5). The rise is -10 and the run is 5, so the slope is -2 and the intercept is 1, giving y = -2x + 1. The distance is about 11.1803 and the midpoint is (0.5, 0).
Formulas
Slope m = (y2 - y1) / (x2 - x1). Y-intercept b = y1 - m x1. Distance = square root of (x2 - x1) squared plus (y2 - y1) squared. Midpoint = ((x1 + x2) / 2, (y1 + y2) / 2). Angle = arctan(m). Percent grade = m times 100.
Reading the result
A positive slope rises from left to right and a negative slope falls. A slope of zero is a flat horizontal line, and the equation becomes y = b. If both x-values are equal the line is vertical, the run is zero, and the slope is undefined; the line is written x = a, where a is the shared x-value. If both points are identical there is no line at all, so the tool asks for two different points.
Tips
Keep the units consistent: if x is in feet and y is in feet, the slope has no units, but mixing meters and feet will give a misleading number. For roofs, ramps and roads, use the percent grade, and remember that a 1:12 ramp has a slope of about 0.083, or 8.3 percent. When graphing, plot the intercept first, then use the rise over run to find the next point. Round only at the end to avoid drifting answers.
Short FAQ
Can the slope be a fraction? Yes. Points (0, 0) and (3, 2) give a slope of 0.6667, which is 2/3. Does it work for curves? No, it measures a straight line between two points; for a curve it gives the average rate of change over that interval.
Who it is for
Students checking algebra and geometry work, teachers building examples, DIY builders figuring out the pitch of a roof or ramp, and anyone who needs a quick line equation from two measurements.