Slope Calculator

The slope between two points (x1, y1) and (x2, y2) is calculated as m = (y2 - y1) / (x2 - x1), representing the rate of change in y per unit change in x. Enter two coordinate points to compute the slope, angle of inclination, distance between the points, midpoint, and the equation of the line in both slope-intercept and point-slope form.

Quick Answer

The slope between points (1, 2) and (4, 8) is 2, meaning the line rises 2 units for every 1 unit it moves to the right.

Common Examples

Input Result
(1, 2) and (4, 8) Slope: 2, Distance: 6.71
(0, 0) and (3, 4) Slope: 1.33, Distance: 5
(-2, 3) and (5, -1) Slope: -0.57, Distance: 8.06
(2, 5) and (2, 10) Slope: Undefined (vertical line)
(0, 3) and (6, 3) Slope: 0 (horizontal line)

How It Works

The Formula

The slope (m) of a line passing through two points (x1, y1) and (x2, y2) is defined as the ratio of the vertical change to the horizontal change:

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

This is often described as “rise over run.” A positive slope means the line goes upward from left to right. A negative slope means the line goes downward from left to right. A slope of zero is a horizontal line. When x1 equals x2, the line is vertical and the slope is undefined.

Angle of Inclination = arctan(m), converted from radians to degrees. This gives the angle the line makes with the positive x-axis.

Distance between the two points uses the Euclidean distance formula derived from the Pythagorean theorem:

d = sqrt((x2 - x1)^2 + (y2 - y1)^2)

Midpoint = ((x1 + x2) / 2, (y1 + y2) / 2), the point exactly halfway between the two given points.

Slope-Intercept Form: y = mx + b, where b is the y-intercept found by substituting one point into the equation.

Point-Slope Form: y - y1 = m(x - x1), using the slope and one of the given points.

Worked Example

For points (1, 2) and (4, 8): Slope = (8 - 2) / (4 - 1) = 6 / 3 = 2. Angle = arctan(2) = 63.43 degrees. Distance = sqrt((4-1)^2 + (8-2)^2) = sqrt(9 + 36) = sqrt(45) = 6.71. Midpoint = ((1+4)/2, (2+8)/2) = (2.5, 5). For slope-intercept form: 2 = 2(1) + b, so b = 0, giving y = 2x. Point-slope form: y - 2 = 2(x - 1).

Related Calculators

Frequently Asked Questions

What does the slope of a line represent?
The slope represents the rate of change between two variables. It tells you how much y changes for each unit increase in x. A slope of 3 means y increases by 3 for every 1 unit increase in x. In real-world contexts, slope can represent speed (distance over time), cost per item, or any rate of change.
What does it mean when the slope is undefined?
An undefined slope occurs when the two points have the same x-coordinate, creating a vertical line. The formula produces a division by zero because x2 - x1 = 0. Vertical lines cannot be expressed in slope-intercept form (y = mx + b) and are instead written as x = a constant.
What is the difference between slope-intercept form and point-slope form?
Slope-intercept form (y = mx + b) expresses the line using its slope and y-intercept, making it easy to graph. Point-slope form (y - y1 = m(x - x1)) expresses the line using its slope and a specific point on the line. Both describe the same line and can be converted to each other algebraically.
Can slope be a fraction or decimal?
Yes. Slope can be any real number, including fractions, decimals, and negative values. A slope of 1/2 means the line rises 1 unit for every 2 units it moves horizontally. A slope of -0.75 means the line falls 0.75 units for every 1 unit to the right.
How is slope related to the Pythagorean theorem?
The distance formula used alongside slope is derived directly from the Pythagorean theorem. The horizontal distance (x2 - x1) and vertical distance (y2 - y1) form the two legs of a right triangle, and the distance between the points is the hypotenuse: d = sqrt((x2-x1)^2 + (y2-y1)^2).