Free calculatorsNo sign-up neededAccurate results
Home›Math›Slope Calculator

Slope Calculator – Slope, Equation and Angle from Two Points

Give any two points and get everything about the line through them: slope as a fraction and decimal, the equation y = mx + b, the angle it makes with the horizontal — plus a live sketch of your line.

100% FreeNo sign-up neededInstant results

Enter two points

Type the coordinates.

MODE
POINT 1
POINT 2
🔒Your information is not stored. All calculations happen in your browser — no data leaves your device.
SLOPE OF THE LINE
—
—
🧾
Line equation
—
slope–intercept form
📐
Angle
—
from horizontal
⛰️
Grade
—
% grade — slope × 100
📏
Distance
—
between Point 1 and Point 2
📍
Midpoint
—
halfway between the points
YOUR LINE, SKETCHED
Key takeaways
  • Slope is rise over run: from (1, 2) to (3, 6) the line climbs 4 over a run of 2 — slope 2, equation y = 2x, angle 63.43°.
  • The answer comes as a decimal and a reduced fraction, with the full y = mx + b equation, the angle, the % grade, the distance between the points, the midpoint, and a sketch of the line.
  • One point plus a slope works too: switch modes to find both intercepts and the two points exactly a chosen distance along the line.

Rise over run, decoded

The slope is how much y changes for every step in x — the DNA of the line.

run = x₂ − x₁ rise m = rise ÷ run
THE CORE IDEA

m = (y₂ − y₁) ÷ (x₂ − x₁) — “rise over run”. Positive slope climbs to the right, negative slope falls, zero slope is flat, and a vertical line has an undefined slope because the run is zero.

Once you have m, the y-intercept is b = y₁ − m·x₁, giving the full equation y = mx + b. The angle follows from the slope: θ = atan(m) in degrees — a slope of 1 is exactly 45°.

Two points always define exactly one line — that is why the calculator needs just four numbers to draw the whole picture.

How to find a slope

Three steps, instant answers.

1
📌
Enter the points

Any two (x, y) coordinates — decimals welcome.

→
2
📈
Read slope and angle

Fraction and decimal slope plus the line’s angle in degrees.

→
3
🧾
Copy the equation

The full y = mx + b form, with a sketch to confirm.

⚙️How slope is calculated

The slope m measures steepness: how many units y rises (or falls) for every unit x moves right. Algebra reduces it to one formula:

m = (y₂ − y₁) ÷ (x₂ − x₁) · b = y₁ − m·x₁
y = mx + b · angle θ = atan(m) in degrees

Worked example: through (1, 2) and (3, 6) → m = (6−2) ÷ (3−1) = 2, b = 2 − 2×1 = 0, so y = 2x, and atan(2) = 63.43°. Through (2, 1) and (2, 5) the run is zero → slope undefined, equation x = 2, a vertical line at 90°.

The four personalities of slope▾

Positive (e.g. 2): the line climbs left to right — bigger x means bigger y. Negative (e.g. −1): the line falls left to right. Zero: perfectly flat, equation y = constant, every x gives the same y. Undefined: a vertical line (x₁ = x₂) — the run is zero and division by zero is impossible, so slope simply does not exist.

Magnitude is steepness: a slope of 2 is twice as steep as a slope of 1 (63.43° versus 45°).

Where slope shows up in real life▾

Slope is everywhere a rate changes: roof pitch and wheelchair ramps are literally rise-over-run; speed is the slope of a distance–time graph; economics reads supply and demand curves by slope; machine learning trains models by following slopes downhill (gradient descent). Perpendicular lines have slopes that are negative reciprocals (m₁ × m₂ = −1); parallel lines share the same slope.

Distance, midpoint, grade — and lines through a point▾

The two-point result also includes the distance between the points, √((x₂ − x₁)² + (y₂ − y₁)²), the midpoint halfway between them, and the slope restated as a % grade (slope × 100 — the form road signs use; a vertical line has no grade). A third mode, Parallel / perpendicular, takes the line from Point 1 and Point 2 plus any third point and returns the two lines through that point: the parallel line, which keeps the same slope, and the perpendicular line, whose slope is the negative reciprocal. Vertical and horizontal lines swap roles — the parallel of a vertical line is vertical, and its perpendicular is horizontal.

Frequently asked questions

How do I find the equation of a line from one point and the slope?

Use point-slope form: y − y₁ = m(x − x₁), then tidy it into y = mx + b. From (2, 3) with slope 2: y − 3 = 2(x − 2), so y = 2x − 1, crossing the x-axis at 0.5. The One point + slope mode in this calculator does it instantly — and with a distance added, it also finds the two points exactly that far along the line.

What is the slope of a line?

The slope measures how steep a line is: rise divided by run, or (y₂ − y₁) ÷ (x₂ − x₁). A slope of 2 means y rises 2 units for every 1 unit x moves right.

What does an undefined slope mean?

The line is vertical: both points share the same x, so the run is zero and division by zero is impossible. The equation becomes x = x₁ (for example, x = 2) and the angle is 90°.

What is the slope-intercept form?

y = mx + b, where m is the slope and b is where the line crosses the y-axis. The calculator computes b = y₁ − m·x₁. For (1,2) and (3,6): m = 2, b = 0, so y = 2x.

How is the angle of the line found?

Angle = atan(slope), converted to degrees. A slope of 1 gives exactly 45°, a slope of 2 gives 63.43°, and a flat line (slope 0) gives 0°. Negative slopes give negative angles below the horizontal.

How do I know if two lines are parallel or perpendicular?

Parallel lines have equal slopes. Perpendicular lines have slopes that are negative reciprocals — their product is −1 (for example, 2 and −½). A vertical line is perpendicular to any horizontal line.

Why does the calculator show the slope as a fraction?

Fractions are exact: a slope of ⅔ is clearer as 2/3 than as 0.667. The calculator shows both the reduced fraction and the decimal, so you get precision and readability at once.

How do I find the slope from standard form Ax + By = C?

Use m = −A/B. For 2x + 3y = 12, A = 2 and B = 3, so m = −2/3. Rearranging confirms it: y = (−2/3)x + 4. Do not forget the minus sign — it decides whether the line rises or falls.

How do I convert a percent grade to degrees?

Take the inverse tangent of the percent as a decimal. A 73% grade is a slope of 0.73, and atan(0.73) = 36.13°. A 100% grade is atan(1) = 45°, the angle where rise equals run.

What percent slope is 1/4 inch per foot?

2.08%. Divide the fall by the run in the same units: 0.25 ÷ 12 = 0.0208, and percent is slope × 100. The same slope is a ratio of 1 : 48 and an angle of 1.19°.

How do I calculate the slope of a drain pipe?

Divide the drop by the length of the run, both measured in the same units. A drop of 1.5 inches over 10 feet is 1.5 ÷ 120 = 0.0125, which is 1.25%, a ratio of 1 : 80, and an angle of 0.72°. The fall a pipe must have is set by the pipe and the local plumbing code, so check the current code for the job — this calculation converts the fall, it does not choose it.

Built slopes: pipe fall, drainage and ramps

A fall over a run is the same slope as a line — only the units change.

A pipe fall, a drainage gradient and a ramp gradient are all rise over run, written in the units of the trade. If m is the slope as a plain number, fall divided by run, then the percent grade is m × 100, the ratio form is 1 : (1 ÷ m), the fall in inches per foot is m × 12, and the fall in millimetres per metre is m × 1000. The angle follows from the slope as atan(m), as in the questions below. The same steepness can be stated in any of these forms, so the first step with a built slope is always to convert the stated fall into the form you are working in.

percent = m × 100 · ratio 1 : (1 ÷ m) · inches per foot = m × 12 · mm per metre = m × 1000

A fall of a quarter of an inch per foot is the conversion people ask for most: m = 0.25 ÷ 12 = 0.0208, which is 2.08%, a ratio of 1 : 48, and an angle of 1.19°. The other way round, a 2% grade is 0.24 inches per foot, 20 millimetres per metre, a ratio of 1 : 50, and an angle of 1.15°. To use this calculator for a stated fall, enter two points in the same units — for example (0, 0) and (12, 0.25), both in feet, a 3-inch fall over 12 feet — and read the slope, angle and percent grade from the result.

For a drain pipe, the fall is the drop over the length of the run: measure both in the same units and divide. This guide states no universal fall figure, because the fall a pipe needs depends on the pipe and on the plumbing code for the job — check the current local code before laying the pipe, and use the conversions above to express its requirement in the units on site. The same caution applies to access ramps: the maximum or required slope for a wheelchair ramp is set by the applicable accessibility code and local rules, and it varies with the kind of ramp, so check the current code for the project rather than taking a single figure from a search result. What this page gives you is the conversion between the forms — percent, ratio, fall per foot and angle — so that whatever figure the code states can be set out and checked.

Slope from an equation, and slope as percent or degrees

Three more ways to meet a slope: hidden in an equation, quoted as a percent, or measured as an angle.

An equation in standard form hides its slope in the ratio of its coefficients: for Ax + By = C, the slope is m = −A/B, minus sign included. For 2x + 3y = 12, A = 2 and B = 3, so m = −2/3; rearranging gives y = (−2/3)x + 4, which confirms it. Forgetting the minus sign flips the line from falling to rising, which is why the formula is worth memorising with its sign attached.

Percent grade and degrees are the same steepness in different units: percent is slope × 100, and degrees come from the inverse tangent. A slope of 0.02 is a 2% grade at 1.15°; a slope of 1/3 is 33.33% (the 3:1 grade) at 18.43°; a slope of 1 is 100% at exactly 45°; and a 73% grade is a slope of 0.73 at 36.13°. Doubling the angle never doubles the percent, because the tangent curve bends upward — 20° is 36.40%, but 40° is 83.91%.

SlopePercent gradeAngle
0.022%1.15°
1/333.33%18.43°
1100%45°
0.7373%36.13°

One honest limit belongs here too: everything on this page is about straight lines. A curve has no single slope — for y = x² the average slope is 1 between x = 0 and x = 1 but 3 between x = 1 and x = 2 — so a two-point answer for a curve is an average over an interval, not the steepness at a point. The companion guides below work the equation forms, the percent-degree conversions, and graph reading in full.

Explore more useful math tools.

View All Math Calculators →
For general information only. This calculator computes slope, line equations and angles from the exact coordinates you enter. Vertical lines (x₁ = x₂) have undefined slope by definition.
↑