Slope Calculator
Enter two points to get the slope of the line through them — as an exact fraction and as a decimal — together with its angle, the distance and midpoint between the points, the equation of the line in three forms, and a graph with the rise and run drawn in.
Whole numbers, decimals or fractions such as 1/2.
Results
4/3
Slope (m)
1.3333
Slope as a decimal
53.13°
Angle of inclination
5
Distance between the points
(5/2, 4)
Midpoint
2/3
y-intercept (b)
Equation of the line
| Slope-intercept form | y = (4/3)x + 2/3 |
|---|---|
| Point-slope form | y − 2 = (4/3)(x − 1) |
| Standard form | 4x − 3y = −2 |
A parallel line has the same slope, 4/3; a perpendicular line has slope −3/4, the negative reciprocal.
The working
m = (y₂ − y₁) / (x₂ − x₁) = (6 − 2) / (4 − 1) = 4 / 3 = 4/3
θ = arctan(m) = arctan(4/3) ≈ 53.13°
d = √((x₂ − x₁)² + (y₂ − y₁)²) = √(3² + 4²) = √25 = 5
M = ((x₁ + x₂) / 2, (y₁ + y₂) / 2) = ((1 + 4) / 2, (2 + 6) / 2) = (5/2, 4)
b = y₁ − m × x₁ = 2 − (4/3) × 1 = 2/3
Graph
How to Use the Slope Calculator
- 1. Enter the two points. Type x₁ and y₁ for the first point and x₂ and y₂ for the second. Whole numbers, decimals and fractions such as 1/2 are all exact.
- 2. Read the slope. It appears as a fraction in lowest terms and as a decimal. A vertical line has an undefined slope, and the calculator says so instead of dividing by zero.
- 3. Pick the equation you need. Slope-intercept, point-slope and standard form are listed together; copy all three with one click. If you typed decimals, the equations use decimals too.
- 4. Check the working and the graph. Each formula is shown with your coordinates substituted, and the graph uses equal units on both axes, so the line leaves at its true angle.
The Slope Formula
Slope
m = (y₂ − y₁) / (x₂ − x₁) = rise / run
Slope measures steepness: how far the line rises (or falls) for every unit it moves to the right. The rise is the change in y and the run is the change in x. It does not matter which point you call the first, as long as you subtract in the same order on the top and the bottom.
| Slope | The line | Example points |
|---|---|---|
| Positive | Rises from left to right | (1, 2) and (4, 6): m = 4/3 |
| Negative | Falls from left to right | (0, 0) and (2, −1): m = −1/2 |
| Zero | Is horizontal: y = constant | (−1, 3) and (4, 3): m = 0 |
| Undefined | Is vertical: x = constant | (2, 1) and (2, 5): the run is 0 |
Worked Example: (1, 2) and (4, 6)
- Slope. m = (6 − 2) / (4 − 1) = 4/3, or about 1.3333: up 4 for every 3 across.
- Angle. θ = arctan(4/3) ≈ 53.13° above the positive x-axis.
- Distance. d = √(3² + 4²) = √25 = 5 — the 3-4-5 right triangle formed by the run and the rise.
- Midpoint. ((1 + 4) / 2, (2 + 6) / 2) = (5/2, 4).
- y-intercept. b = y₁ − m × x₁ = 2 − (4/3) × 1 = 2/3, so the line crosses the y-axis at (0, 2/3).
Three Forms of the Equation of a Line
| Form | Pattern | For the example |
|---|---|---|
| Slope-intercept | y = mx + b | y = (4/3)x + 2/3 |
| Point-slope | y − y₁ = m(x − x₁) | y − 2 = (4/3)(x − 1) |
| Standard | Ax + By = C | 4x − 3y = −2 |
All three describe the same line. Slope-intercept form is the one to graph from, since it shows the slope and where the line crosses the y-axis. Point-slope form is the quickest to write down from a point and a slope. Standard form uses whole numbers with no common factor and a positive x-coefficient, and it is the only one of the three that can describe a vertical line, such as x = 2.
Angle, Grade and Perpendicular Lines
The angle of inclination is θ = arctan(m), measured counterclockwise from the positive x-axis, so it always lies between 0° and 180°. For a negative slope, arctan gives a negative angle and you add 180°: the line through (0, 0) and (2, −1) has arctan(−1/2) ≈ −26.57°, an inclination of about 153.43°. Engineers and road signs express the same steepness as a percent grade, 100 × m, so a slope of 0.06 is a 6% grade.
Parallel lines have equal slopes. Perpendicular lines have slopes whose product is −1: the perpendicular slope is the negative reciprocal, so a line with slope 4/3 is perpendicular to every line with slope −3/4. A horizontal line is perpendicular to a vertical one.
Frequently Asked Questions
- How do you find the slope from two points?
- Subtract the y-coordinates, subtract the x-coordinates in the same order, and divide: m = (y₂ − y₁) / (x₂ − x₁). For (1, 2) and (4, 6), that is (6 − 2) / (4 − 1) = 4/3.
- What is the difference between a zero slope and an undefined slope?
- A zero slope belongs to a horizontal line: the rise is 0, so 0 divided by the run is 0. An undefined slope belongs to a vertical line: the run is 0, and division by zero has no value. Their equations are y = constant and x = constant.
- Does it matter which point is first?
- No. Swapping the points changes the sign of both the rise and the run, and the two sign changes cancel. What does matter is consistency: subtracting y₂ − y₁ on top but x₁ − x₂ underneath flips the sign of the answer.
- How do you write the equation of a line through two points?
- Find the slope, then put it and either point into point-slope form, y − y₁ = m(x − x₁). Rearranging gives slope-intercept form, y = mx + b, where b = y₁ − m × x₁.
- How do you turn a slope into an angle?
- Take the inverse tangent: θ = arctan(m). A slope of 1 is 45°, a slope of √3 is 60°, and a slope of 4/3 is about 53.13°. For a negative slope, add 180° to get the angle measured from the positive x-axis.
- What is the slope of a perpendicular line?
- The negative reciprocal: flip the fraction and change its sign. A line perpendicular to one with slope 2/5 has slope −5/2, and the two slopes multiply to −1.