Slope Calculator
Find the slope and equation of a line through two points, with clear steps and exact answers.
Slope result
Enter two points to see the slope.
How to calculate slope from two points
Enter the coordinates of two points, (x₁, y₁) and (x₂, y₂). Slope describes the change in y for each unit change in x. Subtract the y-coordinates to find rise, subtract the x-coordinates in the same order to find run, then divide.
m = (y₂ − y₁) ÷ (x₂ − x₁) = rise ÷ run
For example, (1, 2) and (5, 8) have rise 8 − 2 = 6 and run 5 − 1 = 4. The slope is 6/4 = 3/2 = 1.5. Reversing both points changes the signs of rise and run together, so the slope stays the same.
Find the line equation and y-intercept
For a nonvertical line, the slope-intercept equation is y = mx + b. After calculating m, substitute either point to find b = y₁ − mx₁.
In the example above, b = 2 − 1.5 × 1 = 0.5, so the line equation is y = (3/2)x + 1/2. The y-intercept is where the line crosses the y-axis, at x = 0.
Positive, negative and zero slopes
A positive slope rises from left to right; a negative slope falls. Equal y-coordinates with different x-coordinates give a horizontal line with slope zero. For example, (−2, 4) and (3, 4) lie on y = 4. A negative run does not by itself mean a negative slope: the signs of both rise and run matter.
Vertical lines and identical points
If x₁ = x₂ but the y-coordinates differ, the line is vertical. Its run is zero, so slope is undefined; it is not a numeric infinity. The equation is x = x₁, and the line cannot be written as y = mx + b.
If both coordinate pairs are identical, rise and run are both zero. One point alone does not determine a unique line or slope. The calculator reports that special case instead of assigning a false slope of zero.
Decimals, units and precision
Enter signed integers, decimals with a period, or scientific notation such as 1e3. Do not include commas or units. Each coordinate supports up to 64 characters, with scientific-notation exponents from −308 to 308. Slash-form fractions are not accepted as coordinate inputs; use decimal coordinates instead.
The calculator converts entered decimal text to exact fractions, so rise, run, slope and intercept avoid floating-point subtraction errors. Exact fraction answers are reduced; decimal slopes display up to 12 significant digits. A decimal approximation such as 0.333333333333 is not the exact value 1/3.
Use the same coordinate system for both points. Slope has units of y per unit x; it is not automatically a distance, angle or percentage grade. This calculator models straight lines in Cartesian coordinates.
Related math tools
Use the Proportion Calculator to solve missing values in equal ratios, or the Percentage Calculator for percentage changes. Read our calculator methodology for how formulas and assumptions are documented.
Frequently Asked Questions
What does slope measure?
Slope measures vertical change divided by horizontal change: (y₂ − y₁) ÷ (x₂ − x₁). For (1, 2) and (5, 8), the slope is 6/4 = 3/2 = 1.5.
What happens when the line is vertical?
Different points with the same x-coordinate define a vertical line. Its run is zero, so slope is undefined rather than a numeric infinity. Its equation is x equal to that shared coordinate.
Does a horizontal line have a slope?
Yes. Distinct points with equal y-coordinates define a horizontal line with slope zero. Identical points, however, do not define a unique line or slope.
Is a slope of 1.5 the same as a 1.5% grade?
No. If both axes use the same length unit, a slope of 1.5 corresponds to 150% grade. Slope, angle, distance, and percentage grade are different quantities; this calculator primarily reports Cartesian slope and line equations.