How to find the slope of a line
The slope of a line tells you how steeply it climbs or falls. Pick any two points on the line, (x₁, y₁) and (x₂, y₂). The rise is the vertical change, y₂ − y₁, and the run is the horizontal change, x₂ − x₁. The slope m is the rise divided by the run: m = (y₂ − y₁) ÷ (x₂ − x₁).
For the points (1, 2) and (4, 6) the rise is 4 and the run is 3, so m = 4/3 = 4/3. This calculator keeps the slope as an exact fraction and also gives a decimal, so a result such as 4/3 is never rounded to 1.33 behind your back. The same line gives the same slope whichever two points you choose, which is a handy way to check a graph.
Slope-intercept, point-slope and standard form
Once you have the slope, a line can be written in three common ways. Slope-intercept form is y = mx + b, where b is the y-intercept, the height at which the line crosses the y-axis. Our first example becomes y = (4/3)x + 2/3. Point-slope form, y − y₁ = m(x − x₁), keeps one known point visible: y - 2 = (4/3)(x - 1). Standard form, Ax + By = C, uses whole-number coefficients: 4x - 3y = -2.
Which one should you use? Slope-intercept is best for graphing and for reading the intercept. Point-slope is quickest when a problem hands you a point and a slope. Standard form is convenient for solving two lines together. They describe exactly the same line, and the calculator shows all of them so you can copy the one your textbook or teacher expects. It also lists the x-intercept, where the line meets the x-axis: -1/2 = -0.5.
Worked examples with a graph
Example one: through (−2, 5) and (3, −5). The rise is −5 − 5 = -10 and the run is 3 − (−2) = 5, so m = -2. The line falls as you move right. Its equation is y = -2x + 1, and the distance between the two points is 11.1803398875.
Example two: the points (0, 0) and (6, 9). The rise is 9 and the run is 6, giving 9/6, which simplifies to 3/2. Reducing the fraction is the same job as finding a greatest common factor, so the fraction calculator is useful here.
Example three uses a point and a slope. Start at (1, 1), move along a line of slope 0.75, and stop 5 units away. The calculator returns the second point (5, 4); going the other way along the same line lands at (-3, -2). The graph beside the result draws the line, marks both points and shades the rise and run triangle, so you can see why the numbers come out as they do.
Vertical lines, horizontal lines and direction
The sign of the slope tells you the direction. A positive slope rises from left to right, and a negative slope falls. A horizontal line has no rise, so its slope is 0: through (0, 3) and (5, 3) the slope is 0 and the equation is y = 3. A vertical line has no run, which would mean dividing by zero, so its slope is undefined: through (2, 1) and (2, 9) the line is x = 2.
Steepness can also be an angle. The angle from the positive x-axis is the inverse tangent of the slope, so a slope of 4/3 corresponds to 53.1301023542 degrees. A vertical line is 90 degrees, and a falling line has a negative angle on the −90 to 90 degree convention used here. If both points are identical there is no line at all, and the calculator says so instead of inventing a slope.
Where slope is used
Slope is a rate of change, so it shows up well beyond geometry class. On a road sign it is the grade, on a roof it is the pitch, and on a chart of price against time it is how quickly the value moves per unit of time. In each case the idea is the same: how far the vertical quantity changes for each step in the horizontal one. A steeper line means a larger absolute slope, and comparing slopes is a quick way to compare rates. Two lines with equal slopes are parallel, and two lines whose slopes multiply to −1 are perpendicular. The line equation the calculator returns lets you test both facts directly.
Frequently asked questions
What is the slope of a vertical line?
It is undefined, because the run is 0 and division by zero has no value. The equation is x = a constant.
Does the order of the two points matter?
No. Swapping the points swaps the sign of both the rise and the run, so the ratio is unchanged. Taking (4, 6) first gives -4/-3 = 4/3, the same as before.
How do I turn a slope into an angle?
Take the inverse tangent of the slope. This page measures the angle from the positive x-axis, between −90 and 90 degrees.
What does a negative slope mean?
The line falls as you move from left to right: y decreases when x increases.
For related work, see the quadratic formula calculator for curves, the fraction calculator for exact slopes, or all calculators.