Slope Calculator
Find the slope, equation, angle & distance from two points
๐ Enter two points
๐ Slope
๐ Line details
๐งฎ Step-by-step
Results use exact arithmetic where possible; decimals are rounded for display. Slope, y-intercept, angle and distance are computed from your two points using standard coordinate-geometry formulas.
Last updated June 2026
Method: Slope uses the standard formula m = (yโ โ yโ) / (xโ โ xโ). The y-intercept, line equation, angle (arctan of the slope) and point-to-point distance follow directly from coordinate geometry.
Included: Slope as a reduced fraction and decimal, y-intercept b, the equation y = mx + b, the angle of incline in degrees, the distance between the two points, and a full step-by-step breakdown.
Not included: Curved lines, slopes from a single equation, or 3D coordinates. This tool works with two points on a flat (2D) coordinate plane.
Slope calculator: everything you need to know
Give this slope calculator two points and it instantly returns the slope of the line that connects them, along with the y-intercept, the full equation in y = mx + b form, the angle the line makes with the horizontal, and the straight-line distance between the points. Take the points (1, 2) and (4, 8): the line rises 6 units while running 3 units across, so the slope is 6 รท 3 = 2, the y-intercept is 0, and the equation is y = 2x. Below the tool, this page explains the slope formula, walks through several worked examples, and clears up the edge cases (vertical lines, horizontal lines, negative slopes) that trip people up.
The slope formula
Slope, almost always written as the letter m, is the ratio of vertical change to horizontal change between two points on a line. The formula is:
m = (y2 − y1) ÷ (x2 − x1) = rise ÷ run The numerator, yโ โ yโ, is called the rise (how far the line moves up or down). The denominator, xโ โ xโ, is the run (how far it moves left or right). Once you have the slope, you can find the rest of the line. The y-intercept comes from rearranging the slope-intercept equation:
b = y1 − m × x1 → y = mx + b And the angle the line makes with the horizontal axis is the inverse tangent (arctangent) of the slope:
angle = arctan(m), in degrees What slope actually tells you
Slope is a measure of steepness and direction. A slope of 2 means that every time x increases by 1, y increases by 2 โ the line climbs steeply to the right. The sign of the slope tells you the direction:
- Positive slope: the line rises from left to right (going uphill).
- Negative slope: the line falls from left to right (going downhill).
- Zero slope: the line is perfectly flat (horizontal).
- Undefined slope: the line is perfectly vertical โ you cannot divide by a run of 0.
How to use this slope calculator
You only need the coordinates of two points. Work through the fields in order:
- Point 1 (xโ, yโ): enter the coordinates of your first point. Negative numbers and decimals are fine.
- Point 2 (xโ, yโ): enter the second point's coordinates.
- Read the slope: the large number at the top is the slope m, shown as a reduced fraction when the rise and run are whole numbers, plus its decimal value.
- Check the details: below the slope you get the y-intercept, the equation of the line, the angle of incline, the grade as a percent, and the distance between the points.
- Follow the steps: the step-by-step panel shows exactly how rise, run, slope and intercept were computed so you can copy the work onto your homework or double-check it.
Everything updates the instant you change a value โ there is no button to press.
Who this calculator is for
- Algebra and geometry students checking homework, learning rise over run, or studying for a test.
- Pre-calculus and calculus learners who need the slope (average rate of change) between two points on a curve.
- Teachers and tutors who want a quick, accurate worked example to share.
- Engineers, surveyors and builders converting a slope into a percent grade or an angle for ramps, roofs and roads.
- Anyone reading a graph who wants to quantify how fast one quantity changes relative to another.
Key terms explained
- Slope (m): the rate of change of y with respect to x โ rise divided by run.
- Rise: the vertical change between the two points, yโ โ yโ. Positive is up, negative is down.
- Run: the horizontal change between the two points, xโ โ xโ. Positive is right, negative is left.
- Y-intercept (b): the y-value where the line crosses the y-axis (where x = 0).
- Slope-intercept form: y = mx + b, the most common way to write a line.
- Grade: slope expressed as a percent (m ร 100). A 5% grade rises 5 units per 100 units of horizontal distance.
Worked example 1: a positive slope
Find the slope of the line through (2, 3) and (6, 11). The rise is 11 โ 3 = 8 and the run is 6 โ 2 = 4, so the slope is 8 รท 4 = 2. To get the y-intercept, plug a point into b = yโ โ mยทxโ: b = 3 โ 2(2) = โ1. The line is y = 2x โ 1, and its angle is arctan(2) โ 63.43ยฐ.
Worked example 2: a negative slope
Find the slope through (โ1, 5) and (3, โ3). The rise is โ3 โ 5 = โ8 and the run is 3 โ (โ1) = 4, so the slope is โ8 รท 4 = โ2. The line falls as you move right. The intercept is b = 5 โ (โ2)(โ1) = 5 โ 2 = 3, giving y = โ2x + 3. The distance between the points is โ((4)ยฒ + (โ8)ยฒ) = โ80 โ 8.94.
Worked example 3: a fractional slope
Find the slope through (0, 1) and (4, 4). The rise is 4 โ 1 = 3 and the run is 4 โ 0 = 4, so the slope is the reduced fraction 3/4 (or 0.75 as a decimal). The line crosses the y-axis at b = 1, so the equation is y = (3/4)x + 1. This is a gentle uphill line โ for every 4 steps right, it rises 3.
Slope, angle and grade reference
Because slope, angle and percent grade all describe the same steepness, it helps to see how common values line up. Use this table as a quick reference:
| Slope (m) | As a fraction | Angle | Grade | Description |
|---|---|---|---|---|
| 0 | 0 | 0ยฐ | 0% | Horizontal (flat) |
| 0.25 | 1/4 | 14.04ยฐ | 25% | Gentle uphill |
| 0.5 | 1/2 | 26.57ยฐ | 50% | Moderate |
| 1 | 1/1 | 45ยฐ | 100% | Diagonal (equal rise & run) |
| 1.732 | โ3 | 60ยฐ | 173.2% | Steep |
| โ1 | โ1/1 | โ45ยฐ | โ100% | Diagonal downhill |
| Undefined | n/a | 90ยฐ | n/a | Vertical |
Notice that a slope of exactly 1 corresponds to a 45ยฐ line, and that the angle approaches 90ยฐ as the slope grows without bound โ which is the geometric reason a vertical line's slope is undefined rather than "infinite."
Vertical and horizontal lines
These two special cases account for most confusion about slope. A horizontal line connects points with the same y-value, so the rise is 0 and the slope is 0 รท run = 0; its equation is y = c. A vertical line connects points with the same x-value, so the run is 0 and the slope is rise รท 0, which is undefined; its equation is x = c. The calculator detects a vertical line and reports an undefined slope with an explanation instead of crashing.
Parallel and perpendicular lines
Slope also tells you how two lines relate. Lines are parallel when they have the same slope (they never meet). Lines are perpendicular when their slopes are negative reciprocals of each other โ that is, the product of the two slopes is โ1. For example, a line with slope 2 is perpendicular to a line with slope โ1/2, because 2 ร (โ1/2) = โ1. A horizontal line (slope 0) is perpendicular to a vertical line (undefined slope).
Tips for getting slope right every time
- Keep the order consistent: whichever point you call (xโ, yโ) in the rise, use it first in the run too.
- Watch the signs: subtracting a negative coordinate adds โ e.g. 3 โ (โ1) = 4, not 2. This is the single most common arithmetic slip.
- Reduce the fraction: a slope of 6/3 is really 2; simplify so the answer is easy to read and compare.
- Sanity-check the sign: if the line clearly goes uphill on a sketch, the slope must be positive. A negative answer means you flipped a subtraction.
- Use rise over run on a graph: if you only have a picture, count grid squares up (rise) and across (run) between two clear lattice points.
Three forms of a linear equation
The slope is the key ingredient in every common way of writing a straight line, and knowing the slope lets you switch between them freely. Each form is useful in a different situation:
- Slope-intercept form, y = mx + b: the form this calculator returns. It is the quickest to graph because you can plot the y-intercept b, then use the slope m as rise-over-run to step to the next point.
- Point-slope form, y − y1 = m(x − x1): the form you build first, the moment you know the slope and any single point on the line. It is handy when a problem gives you a slope and one point but not the intercept.
- Standard form, Ax + By = C: often required in algebra courses and useful for finding intercepts. You can convert from slope-intercept form by moving the mx term to the left side.
For example, the line through (2, 3) with slope 2 is, in point-slope form, y − 3 = 2(x − 2). Distribute and simplify to reach slope-intercept form, y = 2x − 1, and rearrange once more to standard form, 2x − y = 1. All three describe exactly the same line; only the presentation changes.
Two points, one line: the three formulas that share them
The slope formula belongs to a small family of two-point coordinate formulas, and they are easy to mix up because they all start from the same pair of points (x1, y1) and (x2, y2). It helps to see them side by side:
- Slope = (y2 − y1) ÷ (x2 − x1) — the ratio of the differences (this page).
- Distance = √((x2 − x1)² + (y2 − y1)²) — the length of the segment, from the distance calculator.
- Midpoint = ((x1 + x2) ÷ 2, (y1 + y2) ÷ 2) — the point halfway between the two, from the midpoint calculator.
Slope uses division of the differences, distance squares and adds them under a root, and midpoint averages the coordinates. If a homework problem asks for "the equation of the perpendicular bisector," you actually need all three: the midpoint to anchor the line, the slope to find the negative reciprocal, and sometimes the distance to verify your work.
Average rate of change vs. instantaneous slope
For a straight line, the slope is constant — it is the same no matter which two points you pick. For a curve, that is no longer true, and this is where the idea of slope becomes the foundation of calculus. The slope you compute between two points on a curve is the average rate of change over that interval; geometrically, it is the slope of the straight secant line that cuts through the two points. As you slide the second point closer and closer to the first, that secant tilts toward the tangent line at a single point, and its slope approaches the derivative — the instantaneous rate of change. So the humble two-point slope formula on this page is literally the first step toward the derivative: a derivative is just a slope where the run has shrunk to nearly zero.
This connection is why slope shows up far beyond geometry class. The slope of a distance-versus-time graph is speed; the slope of a velocity-versus-time graph is acceleration; the slope of a cost curve is marginal cost in economics. In every case the question is the same: how fast does the vertical quantity change as the horizontal quantity advances by one unit?
Slope in the real world: grade, pitch and ramps
Outside the coordinate plane, slope is usually quoted as a percent grade or an angle, but it is the same rise-over-run ratio.
- Road grade: a highway sign reading "6% grade" means the road drops 6 feet for every 100 feet of horizontal distance — a slope of 0.06, or about 3.4°. Mountain passes rarely exceed 7–8% for sustained stretches.
- Roof pitch: builders express the steepness of a roof as rise per 12 inches of run, such as "4/12" or "6/12." A 6/12 pitch is a slope of 0.5, the same 26.57° line in the reference table above.
- Wheelchair ramps: U.S. accessibility guidance (the ADA Standards) limits a ramp run to a maximum slope of 1:12 — one unit of rise for every twelve units of run, about 8.33% or 4.76°. That is why an entrance one step (roughly 6 inches) above grade needs a ramp at least 6 feet long.
- Stairs: a comfortable staircase has a rise-to-run that lands near a 30–35° angle; far steeper feels like a ladder, far shallower wastes floor space.
In each of these examples you can convert freely: multiply the slope by 100 to read it as a grade percent, or take the arctangent to read it as an angle — exactly the two conversions this calculator performs for you.
How slope connects to linear regression
In statistics, fitting a straight line to a cloud of data points produces a regression line whose slope has a concrete meaning: it is the estimated change in the outcome variable for each one-unit increase in the predictor. If a regression of home price on square footage returns a slope of 150, that says each additional square foot is associated with roughly $150 more in price. The same y = mx + b form you get here is the model; the difference is that regression chooses the slope that minimizes the total squared distance from the points to the line, rather than running exactly through two of them. Understanding two-point slope first makes the regression slope far less mysterious.
How this compares to related calculators
This page answers "what is the slope and equation of the line through two points?" If your question is slightly different, a sister tool fits better:
- For the straight-line length between the same two points, use the Distance Calculator.
- To find the point exactly halfway between them, use the Midpoint Calculator.
- To turn a slope into a percent grade or back, the Percentage Calculator handles the conversion in one step.
- To simplify the rise-over-run ratio or scale it, try the Ratio Calculator.
- For trigonometric work such as arctangent and angles directly, use the Scientific Calculator.
Related concepts
Slope between two points is the foundation for several bigger ideas. In calculus, the slope between two points on a curve is the average rate of change, and as the points get infinitely close it becomes the derivative (the instantaneous slope of the tangent line). In statistics, the slope of a best-fit line in linear regression shows how a response variable changes per unit of the predictor. And in everyday life, slope shows up as the grade of a road, the pitch of a roof, and the rise-to-run ratio that determines whether a ramp meets accessibility standards.
Slope is computed with the standard coordinate-geometry formula and the results are exact for the two points you enter. This calculator is a free educational tool for learning and checking your work; for graded assignments or professional engineering, surveying or construction decisions, confirm the figures independently. It does not constitute professional advice.
โ ๏ธ Common mistakes & edge cases
Mixing up rise and run
Slope is rise over run, not run over rise. Putting the x-difference on top flips your slope to its reciprocal. Always divide the change in y by the change in x.
Subtracting points in different orders
If you compute yโ โ yโ in the numerator, you must compute xโ โ xโ (same order) in the denominator. Subtracting the points in opposite orders gives the wrong sign.
Calling a vertical slope "infinite"
When the run is 0 the slope is undefined, not infinity or zero. A vertical line cannot be written as y = mx + b; it is x = c. Don't confuse it with a horizontal line, whose slope is exactly 0.
Sign errors with negative coordinates
Subtracting a negative number adds: for points (โ2, 1) and (3, 1), the run is 3 โ (โ2) = 5. Forgetting the double-negative is the most frequent source of a wrong slope.
❓ Frequently asked questions
What is the slope formula?
The slope formula is m = (y2 - y1) / (x2 - x1). You subtract the y-coordinates of the two points to get the rise, subtract the x-coordinates to get the run, and divide rise by run. The order does not matter as long as you keep the same point first in both the numerator and the denominator.
How do I find the slope from two points?
Label your points (x1, y1) and (x2, y2). Compute the rise (y2 - y1) and the run (x2 - x1), then divide: m = rise / run. For example, for (1, 2) and (4, 8) the rise is 6, the run is 3, so the slope is 6 / 3 = 2.
What does the slope of a line mean?
Slope measures how steep a line is and which way it tilts. It tells you how much y changes for every one-unit increase in x. A slope of 2 means y goes up 2 units each time x increases by 1. A positive slope rises left to right, a negative slope falls, a zero slope is flat, and a vertical line has an undefined slope.
What is the slope of a vertical line?
A vertical line has an undefined slope. Both points share the same x-value, so the run (x2 - x1) is 0, and division by zero is undefined. A vertical line is written as x = c (a constant) rather than y = mx + b.
What is the slope of a horizontal line?
A horizontal line has a slope of 0. The two points share the same y-value, so the rise (y2 - y1) is 0, and 0 divided by any non-zero run is 0. Its equation is simply y = c, where c is the constant y-value.
How do I find the y-intercept (b)?
Once you know the slope m, plug one point into y = mx + b and solve for b: b = y1 - m * x1. The y-intercept is where the line crosses the y-axis, i.e. the value of y when x = 0.
How is slope related to the angle of a line?
The angle a line makes with the horizontal equals the inverse tangent of the slope: angle = arctan(m), in degrees. A slope of 1 corresponds to 45 degrees, a slope of 0 to 0 degrees, and a steeper slope to an angle approaching (but never reaching) 90 degrees.
What is rise over run?
Rise over run is a plain-language way to describe slope. The rise is the vertical change between two points (up is positive, down is negative) and the run is the horizontal change (right is positive). Slope = rise / run, so a slope of 3/4 means the line rises 3 units for every 4 units it moves to the right.
Can the slope be a fraction or a decimal?
Yes. Slope is just a ratio, so it can be a whole number, a fraction, or a decimal. A slope of 1/2 and a slope of 0.5 are the same thing. This calculator shows the reduced fraction when the rise and run are whole numbers, plus the decimal value.
Does the order of the two points matter?
No, as long as you are consistent. If you put a point's coordinates first in the numerator (the rise), use that same point first in the denominator (the run). Swapping which point is first flips the sign of both the rise and the run, and the two sign changes cancel out, so the slope is the same.
How do I write the equation of a line from the slope?
Use point-slope form first: y - y1 = m(x - x1), where m is the slope and (x1, y1) is any point on the line. Then distribute and simplify to slope-intercept form y = mx + b, or rearrange to standard form Ax + By = C. For slope 2 through (2, 3), point-slope gives y - 3 = 2(x - 2), which simplifies to y = 2x - 1.
What is the slope of parallel and perpendicular lines?
Parallel lines have the same slope, so they never cross. Perpendicular lines have slopes that are negative reciprocals - their product is -1. A line with slope 3 is perpendicular to a line with slope -1/3, and a horizontal line (slope 0) is perpendicular to a vertical line (undefined slope).
How do I convert a slope to a percent grade or an angle?
Multiply the slope by 100 to get the percent grade: a slope of 0.06 is a 6% grade. To get the angle the line makes with the horizontal, take the inverse tangent: angle = arctan(slope) in degrees. A slope of 1 is a 100% grade and a 45-degree angle.
๐ก Good to know
A slope of 1 is a perfect 45ยฐ diagonal
Whenever the rise equals the run, the slope is 1 and the line tilts at exactly 45 degrees. It is a handy mental benchmark: anything steeper than 45ยฐ has a slope greater than 1, anything gentler has a slope between 0 and 1.
Slope and percent grade are the same idea
Road signs that warn of a "6% grade" are quoting slope as a percentage (0.06). Multiply any slope by 100 to read it as a grade, which is how engineers describe roads, ramps and roofs.
The order of the points never changes the slope
Swap which point is "first" and both the rise and the run change sign โ the two sign flips cancel, so the slope stays identical. Just stay consistent within a single calculation.
Related Calculators
Distance Calculator
Calculate the distance between two coordinate points
Midpoint Calculator
Find the midpoint between two points
Percentage Calculator
Solve any percentage problem - what is X% of Y and more
Ratio Calculator
Simplify, scale and solve ratios and proportions
Average Calculator
Calculate the mean, median and mode of numbers
Scientific Calculator
A full scientific calculator with trig, logs and more