Enter two points and this calculator finds the slope of the line through them, as a reduced fraction and a decimal. It also gives the y-intercept, the equation y = mx + b, the distance between the points and the line's angle, and it reports a vertical line as an undefined slope instead of failing.
How to use the Slope calculator
- Type the first point into Point 1: x₁ and Point 1: y₁.
- Type the second point into Point 2: x₂ and Point 2: y₂. Negative numbers and decimals are accepted.
- Read the slope. With whole-number coordinates it appears as a fraction in lowest terms followed by the decimal, such as 3/4 (0.75).
- Check the detail line for the rise and run, the y-intercept, the equation of the line, the distance and the angle of inclination.
How the slope calculation works
Rise over run
Slope measures how much y changes for every one-unit change in x: m = (y₂ − y₁) ÷ (x₂ − x₁). The top is the rise and the bottom is the run. It does not matter which point you call 1 and which you call 2, as long as you subtract in the same order on the top and the bottom; swapping both signs leaves the fraction unchanged.
A positive slope rises from left to right, a negative slope falls, and a slope of 0 means a horizontal line. When the two x values are equal the run is 0, and dividing by zero is not defined. OpenStax describes the slope of a vertical line as undefined, so the calculator returns 'undefined (vertical line x = …)' together with the line's equation.
If both points are identical, there is no single line through them, and the calculator asks for two different points.
Exact fractions and the equation of the line
When all four coordinates are whole numbers, the rise and run are whole numbers too, so the calculator divides both by their greatest common divisor. A rise of 6 and a run of 8 becomes 3/4. A slope like 1/3 is shown as a fraction because its decimal, 0.333333…, never ends. With decimal coordinates, only the decimal slope is shown.
The y-intercept is where the line crosses the y-axis. The calculator computes it as b = (y₁x₂ − x₁y₂) ÷ (x₂ − x₁), which equals y₁ − m·x₁ but avoids rounding the slope first. The equation y = mx + b is then written out, with an exact fractional version when the inputs are whole numbers.
Two more values come from the same points. The distance is √(run² + rise²), the Pythagorean theorem applied to the right triangle the points form. The angle of inclination is arctan(m) in degrees, measured from the positive x-axis; it runs from just above −90° to 90°, with 90° for a vertical line.
Reading slope in everyday terms
Slope is a rate, so its units are 'y units per x unit'. If x is hours and y is miles, a slope of 55 means 55 miles per hour. If x is horizontal distance and y is height, multiplying the slope by 100 gives a percent grade: a slope of 0.05 is a 5% grade, a rise of 5 feet over 100 feet of run.
Slopes also tell you how lines relate. Parallel lines have equal slopes, and perpendicular lines (when neither is vertical) have slopes whose product is −1, such as 2 and −1/2.
Worked examples
Point 1: x₁: 1 · Point 1: y₁: 2 · Point 2: x₂: 5 · Point 2: y₂: 5
- Rise = 5 − 2 = 3; run = 5 − 1 = 4.
- m = 3 ÷ 4 = 3/4 = 0.75.
- b = 2 − 0.75 × 1 = 1.25, so the line is y = 0.75x + 1.25.
- Distance = √(4² + 3²) = √25 = 5; angle = arctan(0.75) ≈ 36.87°.
Result: 3/4 (0.75)
Point 1: x₁: -2 · Point 1: y₁: 3 · Point 2: x₂: 2 · Point 2: y₂: -5
- Rise = −5 − 3 = −8; run = 2 − (−2) = 4.
- m = −8 ÷ 4 = −2, a whole number, so no fraction is needed.
- b = 3 − (−2)(−2) = 3 − 4 = −1, giving y = −2x − 1.
Result: -2
Assumptions and limits
Exact fractions are shown when all four coordinates are whole numbers. A vertical line (x₁ = x₂) has an undefined slope; two identical points do not define a line.
Formula and worked examples last checked November 20, 2026. Spotted a problem? Report an error.
Frequently asked questions
What is the slope formula?
m = (y₂ − y₁) ÷ (x₂ − x₁): the change in y divided by the change in x between two points. For (2, 1) and (6, 9) that is 8 ÷ 4 = 2.
What does an undefined slope mean?
It means the line is vertical. Both points share the same x value, so the run is 0 and the division cannot be done. The line is described by x = constant instead, such as x = 3.
What is the difference between a zero slope and an undefined slope?
A zero slope belongs to a horizontal line: y never changes, so the rise is 0. An undefined slope belongs to a vertical line, where x never changes. A horizontal line has an equation like y = 5; a vertical one looks like x = 5.
How do I find the y-intercept from two points?
Find the slope first, then substitute one point into y = mx + b and solve for b. With (1, 2) and slope 0.75, 2 = 0.75 × 1 + b, so b = 1.25. The calculator shows this value in its detail line.
How do I convert slope to an angle or a percent grade?
The angle is arctan(m): a slope of 1 is 45° and a slope of 0.75 is about 36.87°. The percent grade is the slope times 100, so a slope of 0.08 is an 8% grade.
Are the slopes of perpendicular lines related?
Yes. If neither line is vertical, their slopes multiply to −1, so each is the negative reciprocal of the other. A line with slope 3/4 is perpendicular to any line with slope −4/3.