Skip to content
TheCalcUniverse

Slope Calculator — Find Line Slope & Equation from Two Points

Calculate slope between two points with all three equation forms, distance, midpoint, and angle. Includes simplified fraction and interactive coordinate graph.

✓ Tested formula & cited sources Formula verified 2026-05-17 Runs in your browser — inputs never sent anywhere

See it worked out

Example — X₁ 2, Y₁ 3, X₂ 5, Y₂ 7:

Slope (m)

1.3333

Slope as Fraction

4/3

Direction

increasing (positive slope)

Distance Between Points

5

Slope-Intercept Form

y = 1.3333x + 0.3333

Point-Slope Form

y − 3 = 1.3333(x − 2)

Standard Form

-4x + 3y = 1

Y-Intercept

(0, 0.3333)

Angle from Horizontal (degrees)

53.13°

Midpoint

(3.5, 5)

The formula

m = (y₂ − y₁) / (x₂ − x₁) | y = mx + b | y − y₁ = m(x − x₁) | Ax + By = C

m
Slope
b
Y-Intercept
(x₁, y₁)
Point 1
(x₂, y₂)
Point 2
Distance
Euclidean Distance

Worked example — X₁ 2, Y₁ 3, X₂ 5, Y₂ 7

Slope (m) = 1.3333

Full explanation ↓

How Slope Calculator Works

m = (y₂ − y₁) / (x₂ − x₁) | y = mx + b | y − y₁ = m(x − x₁) | Ax + By = C

The slope formula measures the rate of change between two points on a line. Divide the difference in y-coordinates (rise) by the difference in x-coordinates (run) to get the slope m. Slope-intercept form (y = mx + b) is the most intuitive representation — m tells you the steepness and b tells you where the line crosses the y-axis at (0, b). Point-slope form (y − y₁ = m(x − x₁)) is particularly useful when you know one point on the line and the slope but may not know the y-intercept. Standard form (Ax + By = C) is the preferred format for solving systems of linear equations and for finding both intercepts efficiently. All three forms describe the exact same line, just expressed differently for different purposes.

m
SlopeThe rate of change: rise over run. Positive means the line rises from left to right, negative means it falls, zero means horizontal, and undefined (infinite) means vertical. Slope is the tangent of the angle the line makes with the x-axis.
b
Y-InterceptThe point where the line crosses the y-axis (when x = 0). In slope-intercept form y = mx + b, b is the constant term that shifts the line vertically without changing its steepness.
(x₁, y₁)
Point 1The first known point on the line. Any two distinct points uniquely determine a line in the Cartesian plane. Used as the reference point in point-slope form.
(x₂, y₂)
Point 2The second known point on the line. Together with Point 1, these define the line uniquely. The slope is computed from the differences between the two points.
Distance
Euclidean DistanceThe straight-line distance between the two points computed using the Pythagorean theorem: d = √((x₂−x₁)² + (y₂−y₁)²). Represents the actual length of the line segment connecting the two points.
The slope of a line is the ratio of vertical change (rise) to horizontal change (run)

How to Use

  1. Enter the coordinates of two points — X₁, Y₁ for the first point and X₂, Y₂ for the second point on the line.
  2. View the slope as both a decimal value and a simplified fraction (rise over run) for exact proportional understanding.
  3. Switch to Standard output to see all three equation forms: slope-intercept (y = mx + b), point-slope, and standard form (Ax + By = C).
  4. Use the Angle Display option to see the slope expressed as an angle from horizontal, in either degrees or radians.
  5. Check the direction indicator to understand whether the line is increasing, decreasing, horizontal, or vertical.
  6. The midpoint and distance between the two points are calculated automatically for additional geometric insight.

Quick Reference

Positive slopeLine rises left to right (m > 0)
Negative slopeLine falls left to right (m < 0)
Zero slopeHorizontal line (m = 0, y = constant)
Undefined slopeVertical line (x = constant)
Parallel linesSame slope (m₁ = m₂)
Perpendicular linesm₁ × m₂ = −1
Road grade to slope6% grade = slope of 0.06
ADA max ramp slope1:12 = 0.0833 = 8.3%

Common Uses

  • Finding the slope of a roof to determine roofing material requirements and drainage design
  • Calculating road grade for highway engineering — a 6% grade means the road rises 6 feet per 100 horizontal feet
  • Computing rates of change in physics (velocity from position data, acceleration from velocity data)
  • Determining wheelchair ramp compliance with ADA standards (maximum 1:12 slope ratio)
  • Analyzing data trends in economics, business metrics, and scientific experiments through linear regression

Understanding the Result

The slope of a line measures its steepness and direction. A positive slope means the line rises from left to right; a negative slope means it falls. A zero slope is horizontal, and an undefined (infinite) slope is vertical. The concept of slope dates back to ancient Greek mathematics, where Euclid studied ratios of line segments around 300 BCE. The formal notation m for slope was popularized in the 18th century by mathematicians like Euler, though its exact origin is debated — some attribute it to the French word "monter" (to climb). Slope is fundamental to calculus (derivatives measure the slope of a curve at any point), physics (velocity = slope of a distance-time graph), economics (marginal cost = slope of the cost function), and countless real-world applications. Slope-intercept form (y = mx + b) is the most intuitive — m tells you the steepness and b tells you where the line crosses the y-axis. Point-slope form (y − y₁ = m(x − x₁)) is useful when you know a point and the slope. Standard form (Ax + By = C) is convenient for finding both intercepts quickly and for solving systems of linear equations. The calculator also computes the distance between the two points using the Pythagorean theorem: d = √((x₂ − x₁)² + (y₂ − y₁)²) and the midpoint coordinates. Real-world slope examples: a 6% road grade means the road rises 6 feet for every 100 feet of horizontal distance (slope = 0.06). In architecture, the Americans with Disabilities Act (ADA) limits wheelchair ramp slopes to 1:12 (about 8.3%). Roof pitches are expressed as rise over run (e.g., a 4/12 pitch means 4 inches of rise for every 12 inches of horizontal run).

Worked Examples

Maria, a civil engineer, is designing a wheelchair ramp for a community center entrance. The door threshold is 24 inches above the sidewalk, and she has 20 feet (240 inches) of available horizontal space. Will the ramp meet the ADA maximum slope requirement of 1:12 (approximately 8.3%)?

x1 = 0 · y1 = 0 · x2 = 240 · y2 = 24

Slope m = 0.1 (positive, increasing). Slope as fraction: 1/10. Direction: increasing (positive slope). Distance between points: 241.2015. Angle: 5.71°. Y-intercept: (0, 0). Slope-intercept form: y = 0.1x.

The slope is 24/240 = 0.10, or 10%. This exceeds the ADA maximum of 8.3% (1:12), so Maria needs to either extend the ramp to at least 288 inches (24 feet) or add a switchback. At 288 inches, the slope would be 24/288 = 0.0833, exactly meeting the 1:12 requirement.

James, a homeowner, is checking if his new roof meets local building code. The roof peak is 8 feet above the attic floor, and the horizontal distance from peak to eave is 20 feet. What is the roof pitch as rise-over-run?

x1 = 0 · y1 = 0 · x2 = 20 · y2 = 8

Slope m = 0.4 (positive, increasing). Slope as fraction: 2/5. Direction: increasing (positive slope). Distance between points: 21.5407. Angle: 21.80°. Roof pitch ≈ 5/12. Y-intercept: (0, 0). Slope-intercept form: y = 0.4x.

The slope is 8/20 = 0.4, which as a fraction is 2/5. Roof pitch is typically expressed per 12 inches of run: 0.4 × 12 = 4.8, so this is approximately a 5/12 pitch. This is a moderately steep roof suitable for asphalt shingles. Most building codes require a minimum pitch of 2/12 to 4/12 depending on roofing material.

Priya, a data analyst, is tracking monthly sales growth for her company. January sales were $50,000 and June sales reached $65,000. She wants to find the average monthly sales growth rate from the slope of the trend line.

x1 = 1 · y1 = 50000 · x2 = 6 · y2 = 65000

Slope m = 3000 (positive, increasing). Slope as fraction: 3000/1. Direction: increasing (positive slope). Distance between points: 15000.0025. Angle: 89.98°. Y-intercept: (0, 47000). Slope-intercept form: y = 3000x + 47000. By December (x=12), projected sales ≈ $83,000.

The slope of 3,000 means sales increased by $3,000 per month on average over this period. The slope-intercept form y = 3000x + 47000 tells Priya that the baseline (extrapolated) was $47,000 and the growth trajectory predicts approximately $83,000 by December (x=12) if the trend continues.

Frequently Asked Questions

What does a slope of 0 mean?
A slope of 0 means the line is horizontal — there is no change in y regardless of the change in x. The equation is y = b (a constant). This occurs when y₁ = y₂. In real-world terms, zero slope means steady state or equilibrium: no increase or decrease over time.
What does an undefined slope mean?
An undefined slope means the line is vertical — x never changes. This occurs when x₁ = x₂. The equation is x = a (a constant). Division by zero in the slope formula produces this result. In practical terms, undefined slopes represent instantaneous change (infinite rate), such as a vertical cliff face or an instant price change.
Which equation form should I use?
Slope-intercept form (y = mx + b) is best for graphing and understanding slope intuitively. Point-slope form is ideal when you know one point and the slope. Standard form is useful for solving systems of equations and finding intercepts quickly. For most everyday problems, slope-intercept is the most readable, but all three forms describe the same line.
How do I check if my slope calculation is correct?
Verify by plugging both original points back into the slope-intercept equation y = mx + b. If both points satisfy the equation, the calculation is correct. Alternatively, use the distance between points via the Pythagorean theorem (d = √((x₂−x₁)² + (y₂−y₁)²)) as a cross-check — both methods should be mathematically consistent.
How is slope used in road design and construction?
Road grades are expressed as a percentage (slope × 100). A 6% grade means the road rises 6 feet for every 100 horizontal feet. Highway design standards typically limit grades to 6% on major highways and 12% on local roads. For drainage, roads are designed with a minimum 0.5% cross-slope to prevent water pooling.
What is the difference between slope and rate of change?
They are the same concept. Slope is the geometric term (rise over run on a graph), while rate of change is the applied term (change in one variable per unit change in another). In calculus, the derivative f'(x) gives the instantaneous slope of a curve at any point. The slope calculator gives the average rate of change between two points — as the two points get closer together, this average approaches the derivative.
How do I convert between decimal slope and roof pitch?
Roof pitch is expressed as rise (in inches) per 12 inches of run. To convert: multiply decimal slope by 12. For example, slope = 0.333 converts to a 4/12 pitch (0.333 × 12 = 4). A 6/12 pitch equals slope = 0.5 (6/12). Most residential roofs in North America use pitches between 4/12 and 9/12.
Can I use this calculator for finding if three points form a right triangle?
Yes. Calculate slopes between all three pairs of points. If any two slopes are negative reciprocals (m₁ × m₂ = −1), the corresponding lines are perpendicular and the three points form a right triangle. The distance between points (shown in results) can also verify using the Pythagorean theorem: if d₁² + d₂² = d₃², the triangle is right-angled.

Pro Tips

  • Use the fraction form of slope rather than decimal whenever possible — fractions are exact and reveal proportional relationships that decimals hide. For example, a slope of 4/3 means "for every 3 units right, go up 4 units."
  • When solving systems of equations, use the standard form (Ax + By = C) output from two lines to quickly check if the lines are parallel (same A/B ratio), perpendicular (product of slopes = -1), or intersecting at exactly one point.
  • The distance between points is more than just a geometry exercise — it represents the actual length of material needed for any linear construction between those coordinates (piping, wiring, fencing, road segments).
  • For real-world slope problems, always consider the sign convention: positive slopes in finance indicate growth; in road design, positive slopes mean uphill; in drainage, negative slopes mean water flows in the negative-x direction.
  • The point-slope form is under-appreciated but powerful — it is the most natural form when you know one data point and the rate of change, which is the starting condition for most real-world linear modeling problems.
  • Check your work by plugging both given points back into the slope-intercept equation. If y = mx + b does not produce the correct y for both x values, there is a calculation error.

Limitations to Know

  • Works with exactly two points to define a single line. It does not find the line of best fit for three or more points — use linear regression (available in the statistics calculator) for scatter plot trend lines.
  • Assumes Cartesian coordinates on a flat plane and does not account for Earth curvature. For geographic distances over 10 kilometers, the curvature of the Earth becomes significant — do not use this for surveying or long-distance navigation.
  • The simplified fraction form uses integer approximation with 1e9 precision. For extreme precision needs such as astronomical calculations, use a dedicated symbolic math tool or computer algebra system.
  • Limited to 2D Cartesian line equations. Does not handle 3D lines, lines in polar coordinates, or parametric representations. For 3D geometry, use the distance calculator or a dedicated 3D math tool.
  • Vertical lines through the same x-coordinate produce "undefined" slope and are not expressible in slope-intercept form (y = mx + b). The calculator handles this by displaying the vertical line equation x = constant.
Was this calculator helpful?
Cite this calculator

TheCalcUniverse. "Slope Calculator — Find Line Slope & Equation from Two Points." TheCalcUniverse, 2026, https://thecalcuniverse.com/math/slope-calculator/. Accessed July 24, 2026.

Embed this calculator on your site

Free to embed. Paste this into any HTML page — it stays up to date automatically.

Open embed ↗

You may also like

Guides that use this calculator