Slope Calculator
Enter two coordinate points to calculate the slope of the line between them. See rise and run, an exact simplified fraction when available, the decimal slope, line equation, slope type, and a visual graph.
Point 1
Point 2
How to Use the Slope Calculator
Enter the coordinates of Point 1 as (x₁, y₁) and Point 2 as (x₂, y₂). The points must be different.
The calculator finds the rise, run, slope, slope type, and equation of the line through the two points. A graph shows the points and line together.
When rise and run are whole numbers, the slope is also shown as a reduced fraction when possible. You can swap the two points without changing the slope.
What Is Slope?
Slope measures how quickly one coordinate changes relative to the other along a straight line. In coordinate geometry, it is the change in y divided by the change in x.
A slope of 2 means y changes by 2 units for every 1 unit increase in x. A slope of 1/2 means y increases by 1 unit for every 2 units of horizontal movement.
Slope can also be interpreted as a rate of change. If x represents time and y represents distance, for example, the slope describes how much distance changes for each unit of time.
How to Find Slope Between Two Points
For points (x₁, y₁) and (x₂, y₂), subtract the y-coordinates to find the rise and subtract the x-coordinates in the same order to find the run.
Then divide rise by run. Using (0, 3) and (2, 7), the rise is 7 - 3 = 4 and the run is 2 - 0 = 2. The slope is therefore 4/2 = 2.
The subtraction order must stay consistent. If you calculate y₂ - y₁ for the numerator, use x₂ - x₁ for the denominator.
Rise Over Run
Slope is often described as rise over run. Rise is the vertical change, Δy. Run is the horizontal change, Δx.
A positive rise with a positive run produces a positive slope. A negative rise with a positive run produces a negative slope.
Rise and run do not have to be 1. A rise of 6 and run of 4 gives 6/4, which simplifies to a slope of 3/2.
| Rise | Run | Slope | Movement |
|---|---|---|---|
| 1 | 2 | 1/2 | Up 1 for every 2 right |
| 2 | 1 | 2 | Up 2 for every 1 right |
| -3 | 2 | -3/2 | Down 3 for every 2 right |
| 0 | 4 | 0 | No vertical change |
| 4 | 0 | Undefined | Vertical line |
Positive, Negative, Zero, and Undefined Slope
A line can have a positive, negative, zero, or undefined slope. The sign and whether the run is zero determine the type.
Positive and negative slopes describe lines that change vertically as x changes. Zero slope is horizontal. Undefined slope is vertical.
Undefined slope is not the same as an infinitely large numerical slope. A vertical line has no finite slope because calculating rise divided by run would require division by zero.
| Type | Graph | Condition | Example |
|---|---|---|---|
| Positive | Rises left to right | m > 0 | m = 2 |
| Negative | Falls left to right | m < 0 | m = -3/2 |
| Zero | Horizontal | m = 0 | y = 4 |
| Undefined | Vertical | Δx = 0 | x = 3 |
Does the Order of the Two Points Matter?
Swapping the two points does not change the final slope as long as the subtraction order is reversed consistently.
For example, using (1, 2) and (4, 8) gives rise 6 and run 3, so the slope is 2. Reversing the points gives rise -6 and run -3. Their ratio is still 2.
A common mistake is reversing only the numerator or only the denominator. That changes the sign incorrectly.
Positive and Negative Slope
A positive slope means the line rises as you move from left to right. Both coordinates may increase together, or both may decrease when the points are considered in the opposite direction.
A negative slope means the line falls as you move from left to right. As x increases, y decreases.
The absolute value describes steepness when the axes use comparable scales. A slope of 4 changes vertically faster per unit of x than a slope of 1/2.
Zero and Undefined Slope
A horizontal line has zero slope because y does not change. For points (1, 5) and (8, 5), the rise is 0 and the slope is 0.
A vertical line has undefined slope because x does not change. For points (2, 1) and (2, 5), the run is 0, so the slope calculation would divide by zero.
Horizontal lines have equations such as y = 5. Vertical lines have equations such as x = 2.
Why Two Different Points Are Required
One point alone does not determine a unique straight line. Infinitely many lines with different slopes can pass through the same point.
If both entered points are identical, both rise and run equal zero. The expression 0/0 does not determine a slope, so the calculator requires two distinct points.
Finding the Equation of the Line
For a nonvertical line, the calculator writes the result in slope-intercept form, y = mx + b. Here m is the slope and b is the y-intercept.
After calculating m, the y-intercept can be found by substituting either point into b = y - mx.
For example, a line with slope 2 through (0, 3) has b = 3, so its equation is y = 2x + 3.
Vertical lines cannot be written as y = mx + b because their slope is undefined. They are written instead as x = constant.
Point-Slope Form
A line can also be written in point-slope form as y - y₁ = m(x - x₁). This form is useful when you know one point and the slope.
The two-point slope formula comes from the same relationship. Once the slope is known, either input point can be used in point-slope form to describe the line.
This calculator displays slope-intercept form for nonvertical lines because it makes both slope and y-intercept easy to read.
Slope as a Fraction or Decimal
A slope can be written as a fraction, decimal, or whole number. These are different representations of the same ratio.
A rise of 3 and run of 2 gives a slope of 3/2, which equals 1.5. A rise of -4 and run of 6 simplifies to -2/3, approximately -0.6667.
The calculator shows a reduced fractional slope when rise and run are safe whole numbers. With decimal coordinate differences, the decimal slope remains the primary numerical result.
Reading Slope From a Graph
Choose two distinct points on the same straight line. Measure the vertical change between them, then the horizontal change using the same direction.
Moving right and upward gives positive rise and positive run. Moving right and downward gives negative rise and positive run.
The particular pair of points does not matter on a straight line. Any two distinct points on that line produce the same slope.
Common Slope Mistakes
Mixing subtraction order: If the numerator uses y₂ - y₁, the denominator must use x₂ - x₁.
Calling a vertical slope zero: Vertical lines have undefined slope. Horizontal lines have zero slope.
Using one point twice: Two identical points do not determine a unique line.
Forgetting to simplify the fraction: A rise of 6 and run of 4 gives 6/4, which simplifies to 3/2.
Reading steepness only from appearance: A graph's visual angle can change when the x-axis and y-axis use different scales, even though the numerical slope stays the same.
How This Calculator Works
The calculator computes Δx = x₂ - x₁ and Δy = y₂ - y₁, then divides Δy by Δx when the run is nonzero.
If Δx is zero, it returns an undefined slope and a vertical-line equation. If Δy is zero while Δx is nonzero, it returns a slope of zero.
For other lines, it calculates the y-intercept from b = y₁ - mx₁ and builds the equation y = mx + b.
When rise and run are safe whole numbers, their greatest common divisor is used to reduce the slope fraction to lowest terms.
Slope and Line Formulas
Slope is the change in y divided by the change in x. The same slope can then be used to write an equation of the line.
- Slope
- Coordinates of the first point
- Coordinates of the second point
- Rise or change in y
- Run or change in x
- Y-intercept
- Constant coordinate for a horizontal or vertical line
Examples
Positive slope
(0, 3) and (2, 7)
Rise = 4, run = 2, slope = 2, equation y = 2x + 3.
Fractional slope
(0, 0) and (4, 6)
Rise = 6, run = 4, slope = 3/2 or 1.5, equation y = 1.5x.
Negative slope
(1, 5) and (3, 1)
Rise = -4, run = 2, slope = -2, equation y = -2x + 7.
Zero slope
(1, 5) and (8, 5)
Rise = 0, run = 7, slope = 0, equation y = 5.
Undefined slope
(2, 1) and (2, 5)
Run = 0, slope is undefined, equation x = 2.
Negative coordinates
(-3, -2) and (1, 6)
Rise = 8, run = 4, slope = 2, equation y = 2x + 4.
Swapped points
(4, 6) and (0, 0)
Rise = -6, run = -4, slope = 3/2. Reversing both differences leaves the slope unchanged.
Frequently Asked Questions
What is the formula for slope?
Slope is (y₂ - y₁) divided by (x₂ - x₁). In symbols, m = (y₂ - y₁)/(x₂ - x₁).
How do I find slope between two points?
Subtract the first y-coordinate from the second to get the rise, subtract the first x-coordinate from the second to get the run, then divide rise by run.
What does rise over run mean?
Rise is the vertical change between two points and run is the horizontal change. Their ratio is the slope.
What does slope represent?
Slope represents the change in y for each unit of change in x. It is a rate of change along a straight line.
Can slope be negative?
Yes. A negative slope means y decreases as x increases, so the line falls from left to right.
What does a positive slope mean?
A positive slope means y increases as x increases, so the line rises from left to right.
What does zero slope mean?
Zero slope means the line is horizontal. The y-coordinate stays constant while x changes.
Why is the slope of a vertical line undefined?
A vertical line has no change in x, so its run is zero. Calculating slope would require division by zero.
Is undefined slope the same as zero slope?
No. Zero slope describes a horizontal line. Undefined slope describes a vertical line.
What if both points are identical?
Two identical points do not determine a unique line. Both rise and run would be zero, so the slope cannot be determined.
Does swapping the two points change the slope?
No. Swapping the points changes the signs of both rise and run, so their ratio remains the same.
Can slope be a fraction?
Yes. A rise of 3 and run of 2 gives a slope of 3/2, which is the same as 1.5.
How do I simplify a slope fraction?
Divide the numerator and denominator by their greatest common divisor. For example, 6/4 simplifies to 3/2.
How do I find the equation of a line from two points?
First calculate the slope. Then substitute either point into b = y - mx to find the y-intercept and write the equation as y = mx + b.
What is slope-intercept form?
Slope-intercept form is y = mx + b, where m is the slope and b is the y-intercept.
What is point-slope form?
Point-slope form is y - y₁ = m(x - x₁). It describes a line using its slope and one known point.
What is the equation of a vertical line?
A vertical line is written as x = c, where c is the constant x-coordinate shared by every point on the line.
What is the equation of a horizontal line?
A horizontal line is written as y = c, where c is the constant y-coordinate.
Why can a line look steeper on one graph than another?
The visual angle depends on the scale used on each axis. Changing the graph scale can change how steep the line looks without changing its numerical slope.