Audited ·Last updated 27 Jul 2026·6 citations·Tier 1·0 uses

Slope Calculator

Free slope calculator: enter two points and get slope m, y-intercept b, rise, run, and angle in degrees, with the full slope-intercept equation y = mx + b.

Slope Calculator

The x-coordinate (horizontal position) of the first point on the line. Any real number is allowed — positive, negative, or zero.
The y-coordinate (vertical position) of the first point on the line.
The x-coordinate of the second point. If x₂ equals x₁, the line is vertical and the slope is undefined.
The y-coordinate of the second point. If y₂ equals y₁ and x₂ ≠ x₁, the line is horizontal with slope 0.
Slope (m)
0.75
The slope m = (y₂ − y₁) / (x₂ − x₁). Returns 0 as a sentinel when the line is vertical — see the isVertical flag below.
y-intercept (b)
0
Angle with x-axis (degrees)
36.8699°
Rise (Δy)
3
Run (Δx)
4
Vertical line?
0

Background.

The slope calculator turns two Cartesian coordinates into the single number geometers, builders, drivers, and calculus students all reach for first — the rise over the run. Type the coordinates of any two points (x₁, y₁) and (x₂, y₂) and the tool returns the slope m using the classical two-point formula m = (y₂ − y₁) / (x₂ − x₁), the y-intercept b that completes the equation y = mx + b, the inclination angle θ in degrees, and the raw rise and run values so you can sanity-check the arithmetic by hand.

Behind that one number sits four hundred years of analytic geometry — the discipline René Descartes opened in 1637 when he laid an algebraic grid over Euclid's plane and showed that every line could be reduced to a linear equation. The slope is the modern way of saying how steep, how fast, or how strong: a roof pitched at 6/12 has a slope of 0.5, an interstate highway in the United States rarely exceeds a 6% grade (slope 0.06) because freight trucks lose speed climbing anything steeper, and the Americans with Disabilities Act caps wheelchair-ramp slopes at 1:12 — a slope of about 0.083, or 4.76° — so that someone using a manual chair can propel themselves up without help. In statistics the slope is the regression coefficient that tells you how much one variable moves when another moves by one unit; in physics it is velocity on a position-vs-time graph and acceleration on a velocity-vs-time graph; in calculus it is the limiting case that becomes the derivative dy/dx the moment you let the two points slide together.

Vertical lines are the one exception the formula cannot handle: when x₁ equals x₂ the run is zero, division by zero is undefined, and we say the slope does not exist — this calculator flags that case explicitly with an isVertical indicator and returns 90° as the line's inclination so downstream consumers don't silently treat a wall as a floor. Horizontal lines, by contrast, are perfectly well-defined and produce a slope of exactly 0, an intercept equal to the shared y-coordinate, and an angle of 0°.

Parallel lines share the same slope; perpendicular lines have slopes whose product is −1 (negative reciprocals); and any three points lie on a common line if and only if every pair of them yields the same slope — three quick rules that turn slope from a number into an entire toolkit for plane geometry, drafting, navigation, and data analysis. Whether you are building a deck, checking a ramp for ADA compliance, fitting a regression line, or working through a coordinate-geometry homework problem, this is the calculator that does the algebra so you can think about the geometry.

What is slope calculator?

The slope of a straight line is the ratio of vertical change to horizontal change between any two points on the line — universally written as m = (y₂ − y₁) / (x₂ − x₁). Conceptually it answers a single question: for every one unit you move to the right along the x-axis, how many units does the line move up (or down) along the y-axis? A slope of 2 means up two for every one across; a slope of −0.5 means down half a unit for every one across; a slope of 0 means perfectly horizontal; an undefined slope means perfectly vertical. Slope is a dimensionless number when both axes share the same unit, but in applied settings it carries the units of dy/dx — so a position-time graph has slope in metres per second (velocity), a cost-output graph has slope in dollars per widget (marginal cost), and a topographic profile has slope as a grade or percentage. Slope is the foundational quantity of analytic geometry, the building block of linear regression in statistics, and the gateway to the derivative in calculus — every tangent line at every point on every smooth curve is just a line with a slope.

How to use this calculator.

  1. Pick any two distinct points that lie on the line and read off their coordinates as (x₁, y₁) and (x₂, y₂). The order doesn't matter as long as you keep it consistent — swapping both pairs gives the same slope.
  2. Type x₁ and y₁ into the first two fields. Negative numbers and decimals are fine.
  3. Type x₂ and y₂ into the next two fields. The calculator runs the moment all four values are present — there's no submit button.
  4. Read the primary result — Slope (m) — at the top of the results panel. This is the rise-over-run value plugged into the formula.
  5. Use the y-intercept (b) to write the line in slope-intercept form: y = mx + b. If you'd rather use point-slope form, plug m into y − y₁ = m(x − x₁).
  6. Check the Angle output if you need the line's inclination — useful for ramps, roofs, and roadway grades. Multiply slope by 100 to convert to a percentage grade (a slope of 0.06 = a 6% grade).
  7. Watch the isVertical flag. If it reads 1 the slope is mathematically undefined and the slope and intercept outputs are sentinels (zero) rather than real values — the line is vertical and its equation is simply x = x₁.

The formula.

m = (y₂ − y₁) ⁄ (x₂ − x₁)

The slope formula m = (y₂ − y₁) / (x₂ − x₁) is a direct algebraic restatement of the geometric idea of "rise over run". The numerator (y₂ − y₁) is the rise — the signed vertical distance you climb (or descend) between the two points. The denominator (x₂ − x₁) is the run — the signed horizontal distance you travel between them. Their ratio is the constant rate at which y changes with respect to x along the line, and because every pair of points on a straight line produces the same ratio, m is a property of the line itself, not of the points you happened to pick. Once you have m, the y-intercept follows from rearranging y = mx + b at either known point: b = y₁ − m·x₁ (equivalently b = y₂ − m·x₂ — both yield the same b). Together m and b complete the slope-intercept equation y = mx + b, the canonical algebraic description of a non-vertical line. The inclination angle θ — the angle the line makes with the positive x-axis — is recovered from the slope by θ = arctan(m), measured in radians and converted to degrees with the factor 180/π. This calculator uses the two-argument arctangent atan2(rise, run) and then normalises the result into the half-open interval (−90°, 90°] so the angle always describes the line's tilt rather than a directed bearing — a line going up-and-right at 30° and the same line traversed in the opposite direction (down-and-left at 30°) report the same inclination. The vertical-line case (x₁ = x₂) is the formula's one true exception: the run is zero, division is undefined, and no real number m exists. We flag this with isVertical = 1, return 90° for the angle (which is geometrically correct), and emit zeros for the slope and intercept as sentinel values you can detect and handle in downstream code.

A worked example.

Example

Take the points (0, 0) and (4, 3) — the classic 3-4-5 right-triangle setup with the right-angle vertex at the origin. The rise is y₂ − y₁ = 3 − 0 = 3 and the run is x₂ − x₁ = 4 − 0 = 4, so the slope is m = 3 ÷ 4 = 0.75. Because point 1 sits at the origin, the y-intercept is b = 0, and the line's equation is y = 0.75x — it passes through the origin and climbs three units for every four units to the right. The inclination angle is θ = arctan(0.75) ≈ 36.87° (this is the famous 3-4-5 triangle angle and the same angle a roof with a 9-in-12 pitch makes with the horizontal). In comparison, take a vertical example: from (2, 1) to (2, 5) the run is 2 − 2 = 0 and the formula breaks — the slope is undefined, the equation collapses to x = 2, the calculator sets isVertical = 1, and the reported angle is 90°. Use that flag in any spreadsheet or script that consumes these outputs so you can branch on the vertical case explicitly instead of mishandling a sentinel zero as a real horizontal slope.

y10
x10
y23
x24

Frequently asked questions.

Why is the slope of a vertical line undefined?
Because the run (x₂ − x₁) is zero, and division by zero is not defined in the real numbers. A vertical line moves an infinite amount in y for every zero units in x, so no finite value of m can describe it. The correct description of a vertical line is the equation x = c, where c is the shared x-coordinate. This calculator flags the case with isVertical = 1 and returns 90° for the angle (geometrically correct) but emits zero as a sentinel value for slope and intercept — always check the flag before treating those outputs as real numbers.
What does it mean when two lines have the same slope?
They are parallel. Two non-vertical lines y = m₁x + b₁ and y = m₂x + b₂ are parallel if and only if m₁ = m₂ and b₁ ≠ b₂ (if b₁ = b₂ as well, they are the same line). Parallel lines never meet because at every x they sit a constant vertical distance apart equal to b₂ − b₁. Vertical lines are all parallel to each other regardless of their x-coordinates.
How do I know if two lines are perpendicular from their slopes?
Two non-vertical lines are perpendicular if and only if the product of their slopes is −1 — that is, their slopes are negative reciprocals. If one line has slope 2, the perpendicular line has slope −1/2. If one line has slope −3/4, the perpendicular line has slope 4/3. A horizontal line (slope 0) is perpendicular to a vertical line (undefined slope); this is the one perpendicular pair the m₁·m₂ = −1 rule cannot capture and you have to handle as a special case.
What is the difference between point-slope form and slope-intercept form?
Slope-intercept form y = mx + b uses the slope m and the y-intercept b — it is the easiest form to graph because b tells you exactly where the line crosses the y-axis. Point-slope form y − y₁ = m(x − x₁) uses the slope m and any single known point (x₁, y₁) — it is the easiest form to write down when you already know a point on the line but not the y-intercept (for example after computing a derivative at a specific x). Both describe the same line; pick the form whose pieces you already have in hand.
How is slope related to the derivative in calculus?
The derivative is the slope of the tangent line. Geometrically, dy/dx at a point P on a curve is defined as the limit of the slopes of the secant lines through P and a nearby point Q as Q slides toward P. The two-point slope formula m = (y₂ − y₁) / (x₂ − x₁) is exactly the difference quotient Δy/Δx — letting Δx approach zero turns it into the derivative. Every theorem about lines (parallel, perpendicular, intercepts) has a calculus counterpart for tangent lines on smooth curves.
What slope counts as steep for a roof, a ramp, or a road?
Roofs are quoted as pitch (rise per 12 inches of horizontal run): a 4/12 pitch is a slope of 0.333 (≈ 18.4°), a 6/12 is 0.5 (≈ 26.6°), a 12/12 is slope 1 (45°). Wheelchair ramps under the ADA 2010 Standards must not exceed a 1:12 slope (≈ 0.083, ≈ 4.76°) for new construction, with shorter alterations to existing buildings allowed up to 1:10 or 1:8. US Interstate highways are generally designed for a maximum grade of about 6% (slope 0.06) in mountainous terrain, with 3–4% preferred on rural mainlines so heavy trucks don't lose speed.
Does the order of the two points matter?
No, as long as you keep the order consistent in numerator and denominator. (y₂ − y₁) / (x₂ − x₁) and (y₁ − y₂) / (x₁ − x₂) both equal the same slope because the negative signs in numerator and denominator cancel. What you must not do is mix the order — taking (y₂ − y₁) / (x₁ − x₂) flips the sign of the slope and gives the wrong answer.
What is the slope of a horizontal line?
Exactly zero. The rise (y₂ − y₁) is zero because both points share the same y-coordinate, and 0 divided by any non-zero run is 0. The line's equation is y = c, where c is that shared y-coordinate, the y-intercept equals c, and the inclination angle is 0°. Slope 0 is a real, fully defined value — do not confuse it with the undefined slope of a vertical line.
How do I convert slope to a percentage grade or to an angle?
To convert slope to a percentage grade, multiply by 100: a slope of 0.06 is a 6% grade. To convert slope to an angle in degrees, take the arctangent and convert from radians: θ = arctan(m) × 180/π. So slope 1 is a 100% grade and a 45° angle; slope 0.5 is a 50% grade and ≈ 26.57°; slope 0.083 (the ADA ramp limit of 1:12) is an 8.3% grade and ≈ 4.76°. This calculator reports the angle directly as the angleDegrees output.
Can I use the slope formula for non-straight curves?
Only locally. The two-point formula m = (y₂ − y₁) / (x₂ − x₁) computes the slope of the secant line through two points on any curve, which is the average rate of change of y with respect to x over that interval. It only equals a constant — the slope of the curve itself — when the curve is actually a straight line. For curves, the instantaneous slope at a single point is the derivative, obtained by letting the second point slide arbitrarily close to the first; the secant slope is its discrete approximation.

In this category

Embed

Quanta Pro

Paid features are coming later.

  • All 313 calculators remain free
  • No billing is enabled
Coming soon