Slope Calculator
Calculate slope, angle, distance, midpoint, and line equation
Point 1 (x₁, y₁)
x
y
Point 2 (x₂, y₂)
x
y
Slope (m)
2
Angle of inclination
63.4349°
Distance
8.9443
Midpoint
(3, 6)
y-intercept (b)
0
Line equation
y = 2x + 0
How slope is calculated
The slope of a line through two points (x₁, y₁) and (x₂, y₂) is m = (y₂ − y₁) / (x₂ − x₁) — rise over run. This tool also computes the angle of inclination (arctan of the slope, in degrees), the Euclidean distance between the points (√((Δx)² + (Δy)²)), the midpoint, and the full slope-intercept equation y = mx + b where b = y₁ − mx₁. A vertical line has an undefined slope; a horizontal line has slope 0. All values round to 4 significant figures.
Built and maintained by Meet Shah · Last updated
What this tool is used for
- Finding the gradient between two coordinate points.
- Getting the line equation from two points.
- Working out an angle from a rise and a run.
- Finding the midpoint and distance alongside the slope.
- Checking a gradient against a plotted line to catch a sign error.
Frequently Asked Questions
- What is the formula?
- Rise over run: (y₂ − y₁) ÷ (x₂ − x₁). The order must match on top and bottom — subtracting the points in opposite orders flips the sign, which is the most common arithmetic slip and turns an uphill line into a downhill one.
- Why is a vertical line undefined rather than infinite?
- Because the run is zero and division by zero has no value. A vertical line genuinely has no slope in this sense; its equation is x = k, which cannot be written as y = mx + b at all.
- How do slopes relate for parallel and perpendicular lines?
- Parallel lines share a slope. Perpendicular ones have slopes whose product is −1, so the perpendicular to a line of slope 2 has slope −½ — the negative reciprocal. The vertical/horizontal pair is the exception, since one of them has no slope to reciprocate.
- How does slope relate to a percentage grade?
- A grade is the slope as a percentage: a slope of 0.08 is an 8% grade, which is a steep road. Roofers use a different convention again — "6 in 12" pitch means a rise of 6 per 12 of run, a slope of 0.5.
- What does the intercept mean?
- Where the line crosses the y-axis, the value of y when x is zero. In a real model that is the starting value before anything accumulates — and it is often meaningless in context, such as a fitted line predicting a weight at height zero.
Common errors and gotchas
- Dividing rise by run in the wrong order, which inverts the gradient.
- Reporting an undefined slope as zero for a vertical line, which are opposite cases.
- Confusing the gradient with the angle, which needs an arctangent.
- Mixing up the point order, which flips the sign of the difference but not of the slope.
- Reading a percentage gradient as a ratio, which differ by a factor of a hundred.
Related Calculators tools
Percentage Calculator
Solve percentage, increase, and change calculations.
Age Calculator
Calculate exact age in years, months, and days.
Unix Timestamp Converter
Convert Unix epoch timestamps to and from human dates.
Tip Calculator
Calculate tip and split the bill between people.
Aspect Ratio Calculator
Solve width or height for a target aspect ratio.
Temperature Converter
Convert between Celsius, Fahrenheit, and Kelvin.
Data Storage Converter
Convert between bytes, KB, MB, GB, TB, and more.
Discount Calculator
Calculate sale price and savings from a discount.