Slope Calculator

Find the slope, line equation, and angle of inclination for any two points — or solve for a missing coordinate.

📈 Slope Calculator

Enter the coordinates of two points on the line.

Enter the slope and three of four coordinates. Leave the unknown field blank.

Slope (m)
Line Equation
Y-Intercept (b)
Angle of Inclination
Rise / Run
Direction

What is the Slope Formula?

The slope of a line measures how steep it is: how much the y-value changes for every one unit increase in x. It is often called rise over run because it equals the vertical change (rise) divided by the horizontal change (run) between any two points on the line.

m = (y2 - y1) / (x2 - x1)

The slope is a single number that fully describes the steepness and direction of a straight line:

  • Positive slope: the line rises left to right
  • Negative slope: the line falls left to right
  • Zero slope: the line is horizontal (y does not change)
  • Undefined slope: the line is vertical (x does not change, and division by zero is undefined)

Once you have the slope, you can write the full line equation in slope-intercept form: y = mx + b, where m is the slope and b is the y-intercept (the y-value where the line crosses the y-axis, found by b = y1 - m*x1).

Slope is fundamental in algebra, calculus (where it generalizes to the derivative), physics (rate of change), engineering (gradients), and everyday contexts such as road incline ratings and roof pitch calculations.

Formula and Variables

Slope: m = (y2 - y1) / (x2 - x1)
Y-intercept: b = y1 - m * x1
Line equation: y = mx + b
Angle of inclination: theta = arctan(|m|) in degrees
Find missing y2: y2 = y1 + m * (x2 - x1)
Find missing x2: x2 = x1 + (y2 - y1) / m
Find missing y1: y1 = y2 - m * (x2 - x1)
Find missing x1: x1 = x2 - (y2 - y1) / m

Variables:

  • m — slope (rise over run)
  • x1, y1 — coordinates of the first point
  • x2, y2 — coordinates of the second point
  • b — y-intercept (where the line crosses the y-axis)
  • theta — angle between the line and the positive x-axis (0 to 90 degrees)

How to Use the Slope Calculator

Steps to Calculate

1
Choose a mode — Select Find Slope to compute slope from two points, or Find Missing Coordinate to work backwards from a known slope.
2
Enter coordinates — For Find Slope, enter both points (x1, y1) and (x2, y2). For Find Missing Coordinate, enter the slope m and the three known values, leaving the unknown field blank.
3
Click Calculate — The calculator instantly computes the slope, line equation, y-intercept, angle of inclination, and rise/run.
4
Read the results — Slope is the primary result. The line equation y = mx + b lets you find y for any x. The angle shows how steep the line is in degrees.
5
Use for further work — Copy the slope m or y-intercept b into other calculations such as parallel/perpendicular line problems.

Example Calculations

Example 1 — Positive slope from (1, 2) and (4, 8)
1
m = (8 - 2) / (4 - 1) = 6 / 3 = 2
2
b = 2 - 2*1 = 0
3
Equation: y = 2x
4
Angle: arctan(2) = 63.4349°
Try this example
Slope: 2 | Equation: y = 2x | Angle: 63.4349°
Example 2 — Negative slope from (0, 5) and (5, 0)
1
m = (0 - 5) / (5 - 0) = -5 / 5 = -1
2
b = 5 - (-1)*0 = 5
3
Equation: y = -1x + 5
4
Angle: arctan(1) = 45°
Try this example
Slope: -1 | Equation: y = -1x + 5 | Angle: 45°
Example 3 — Zero slope (horizontal line) from (2, 3) and (7, 3)
1
m = (3 - 3) / (7 - 2) = 0 / 5 = 0
2
b = 3
3
Equation: y = 3
4
Angle: arctan(0) =
Try this example
Slope: 0 | Equation: y = 3 | Angle: 0°
Example 4 — Find missing y2 given slope 3 and points (1, 4) and (5, ?)
1
y2 = y1 + m * (x2 - x1) = 4 + 3 * (5 - 1) = 4 + 12 = 16
Try this example
y₂ = 16

Frequently Asked Questions

What is the slope formula?+
The slope formula is m = (y2 - y1) / (x2 - x1). It measures the rate of change: how much y changes for each unit increase in x. A positive value means an upward line; negative means downward; zero means horizontal; undefined means vertical (x1 = x2).
How do you find the slope between two points?+
Subtract the y-coordinates (y2 minus y1) to get the rise. Subtract the x-coordinates (x2 minus x1) to get the run. Divide rise by run: m = rise / run. For example, for (1, 2) and (4, 8): rise = 6, run = 3, slope = 2.
What does it mean when slope is undefined?+
Slope is undefined when the two points have the same x-coordinate (run = 0), meaning the line is perfectly vertical. Division by zero is undefined in mathematics, so vertical lines have no defined slope. Their equation is written as x = constant.
What is the slope-intercept form y = mx + b?+
Slope-intercept form is y = mx + b, where m is the slope and b is the y-intercept (where the line crosses the y-axis). It is the most common way to write a line equation because both key values are directly readable. Given slope m and a point (x1, y1), you get b = y1 - m*x1.
How is the angle of inclination calculated?+
The angle of inclination equals arctan of the absolute value of slope, converted to degrees: theta = atan(|m|) * (180 / pi). A slope of 1 gives 45 degrees. A slope of 0 gives 0 degrees (horizontal). A vertical line corresponds to 90 degrees.
What is rise over run?+
Rise over run is an everyday name for the slope formula. Rise is the vertical change (y2 - y1); run is the horizontal change (x2 - x1). Slope = rise / run. A ramp that rises 1 m for every 12 m of horizontal distance has slope 1/12 ≈ 0.083.
Can the slope be negative or zero?+
Yes. A negative slope means the line falls from left to right (e.g., slope = -2). Zero slope means the line is perfectly horizontal (y never changes). Only undefined slope (vertical line) is not a real number. All other real-number slopes, including negative and fractional, are valid.
Does the order of the two points affect the slope?+
No. Swapping the two points gives the same slope because both rise and run change sign, and the negatives cancel: (y2-y1)/(x2-x1) = (y1-y2)/(x1-x2). You will always get the same numerical slope regardless of which point you call point 1 or point 2.
How do parallel and perpendicular lines relate to slope?+
Two lines are parallel if and only if they have equal slopes (and different y-intercepts). Two lines are perpendicular if their slopes are negative reciprocals: m1 times m2 equals -1. For example, slopes 3 and -1/3 are perpendicular because 3 times (-1/3) = -1.
How do I find a missing coordinate using slope?+
Rearrange the slope formula. If y2 is unknown: y2 = y1 + m*(x2-x1). If x2 is unknown: x2 = x1 + (y2-y1)/m. If y1 is unknown: y1 = y2 - m*(x2-x1). If x1 is unknown: x1 = x2 - (y2-y1)/m. Use the Find Missing Coordinate mode in this calculator for instant results.
How is slope used in real life?+
Slope appears in road grade percentages, roof pitch ratios, wheelchair ramp regulations (maximum 1:12 slope), ski run ratings, speed-time graphs in physics (slope = acceleration), cost-vs-quantity graphs in economics, and any situation involving a constant rate of change between two variables.
What is the difference between slope and gradient?+
In mathematics, slope and gradient refer to the same quantity: rise divided by run. In civil engineering, gradient often means slope expressed as a percentage (multiply by 100) or as a ratio (e.g., 1 in 12). In multivariate calculus, gradient refers to the vector of partial derivatives, but for a single 2D line the two terms are interchangeable.

What is the slope formula?

The slope formula is m = (y2 - y1) / (x2 - x1). It measures the rate of change: how much y changes for each unit increase in x. A positive value means an upward line; negative means downward; zero means horizontal; undefined means vertical.

How do you find the slope between two points?

Subtract the y-coordinates (y2 minus y1) to get the rise. Subtract the x-coordinates (x2 minus x1) to get the run. Divide rise by run: m = rise / run. For example, for (1, 2) and (4, 8): rise = 8 - 2 = 6, run = 4 - 1 = 3, slope = 6/3 = 2.

What does it mean when slope is undefined?

Slope is undefined when the two points share the same x-coordinate, making the run (x2 - x1) equal to zero. Division by zero is undefined in mathematics. Geometrically this represents a perfectly vertical line, which has no slope in the traditional sense.

What is the slope-intercept form of a line?

The slope-intercept form is y = mx + b, where m is the slope and b is the y-intercept (the y-value where the line crosses the y-axis). It is the most common way to write a line equation because m and b are directly readable from the formula.

How is the angle of inclination calculated from slope?

The angle of inclination theta equals arctan(|m|), converted to degrees: theta = atan(|m|) * (180/pi). A slope of 1 gives 45 degrees. A slope of 0 gives 0 degrees (horizontal). A vertical line is 90 degrees. The absolute value is used so the angle is always between 0 and 90 degrees.

What is rise over run?

Rise over run is an informal name for the slope formula. Rise is the vertical change (y2 - y1) between two points; run is the horizontal change (x2 - x1). Slope = rise / run. For example, a roof that rises 3 metres for every 12 metres of horizontal span has a slope of 3/12 = 0.25.

Can the slope be a decimal or fraction?

Yes. Slope can be any real number: positive integer, negative fraction, zero, or irrational. For example, the slope of the line through (0, 0) and (3, 1) is 1/3 ≈ 0.3333. This calculator displays decimals rounded to four places.

How do I find a missing coordinate if I know the slope?

Use the Find Missing Coordinate mode. Enter the known slope and the three known coordinate values, leaving the unknown field blank. The calculator solves the slope formula for the missing value: for example, if slope m, x1, y1, and x2 are known, then y2 = y1 + m*(x2-x1).

What is a negative slope?

A negative slope means the line falls from left to right: as x increases, y decreases. The steeper the downward angle, the more negative the slope. For example, a line through (0, 5) and (5, 0) has slope (0-5)/(5-0) = -1.

Are parallel lines and slope related?

Yes. Two lines are parallel if and only if they have the same slope (and different y-intercepts). Two lines are perpendicular if their slopes are negative reciprocals: m1 * m2 = -1. For example, slopes 2 and -0.5 are perpendicular.

Does the order of the two points affect the slope?

No. Swapping (x1, y1) and (x2, y2) gives the same slope because both the numerator and denominator change sign, and the negatives cancel. m = (y2-y1)/(x2-x1) = (y1-y2)/(x1-x2).

How is slope used in real life?

Slope appears in road gradients (a 6% grade means 6 cm rise per 100 cm run), roof pitch, wheelchair ramp regulations, ski run ratings, speed-time graphs in physics, interest-rate curves in finance, and any situation involving a constant rate of change between two variables.