HomeCalculatorsMathSlope Calculator

Slope Calculator

Math

Calculate the slope, y-intercept, angle, and equation of a line between two points. Enter coordinates (x₁ and y₂) to get the line equation instantly. Free tool.

Reviewed by the thecalcu.com team · Last updated July 25, 2026

x₁
y₁
x₂
y₂

Point 1

(2, 3)

Point 2

(6, 11)

Slope (m)

0

Line Equation

y = 0x

Y-Intercept (b)

0

Angle (θ)

Distance

0

Direction

↘ Falling

What is a Slope?

The Slope Calculator computes the slope, y-intercept, angle of inclination, and distance between two points from a pair of (x, y) coordinates. It then builds the full linear equation in slope-intercept form (y = mx + b) or handles the special vertical-line case (x = c), and shows whether the line is rising, falling, horizontal, or vertical.

Slope (gradient) is the fundamental measure of a line's steepness: it quantifies how many units the line rises or falls for every one unit of horizontal movement. A slope of 3 means the line climbs 3 units for each unit right; a slope of −0.5 means it falls 0.5 units per unit right. Slope is the building block of all linear relationships in mathematics and data analysis, the coefficient m in y = mx + b is the slope, and it appears in every linear regression model, rate-of-change calculation, and coordinate geometry problem.

In Indian school mathematics, slope is a central topic in CBSE Class 11 (Chapter 10: Straight Lines) and is a prerequisite for calculus (the derivative of a function at a point is the slope of the tangent line). It appears in JEE Main and Advanced coordinate geometry problems involving conditions for parallelism, perpendicularity, angle between lines, and finding the equation of a line given various conditions.

The Pythagorean Theorem Calculator is a natural companion, the distance between two points is the hypotenuse of the right triangle formed by the coordinate differences, and the slope's angle of inclination θ = arctan(m) relates directly to the triangle's trigonometry.

Why Use a Slope Calculator?

Computing slope itself (Δy/Δx) is a single division, but the follow-on calculations, y-intercept (requires substituting a point), angle (requires arctan), distance (requires square root of sum of squares), and building the equation string with correct sign handling, each take additional steps. The combination is fast to verify with a calculator but tedious to do accurately by hand, especially when coordinates involve decimals or negatives.

The equation-building output (e.g., "y = −2.5x + 7.75") is particularly useful when you need to plug the line equation into further coordinate geometry calculations, finding the intersection with another line, checking if a third point lies on the line, or solving for y at a specific x.

The direction indicator (Rising / Falling / Horizontal / Vertical) gives an immediate sanity check: if the slope is supposed to be negative (falling line) but you see "Rising", there's a data entry error to catch before proceeding.

Who Should Use This Calculator?

Class 11 students covering the Straight Lines chapter in CBSE Mathematics, where computing slope, intercept, and line equation from two points is a core skill. The calculator verifies answers and shows the sign-handling in the equation display, which is a frequent source of errors (e.g., y = 2x − 1 vs y = 2x + (−1)).

JEE Main and Advanced aspirants who encounter slope in coordinate geometry problems, collinearity of three points (slope AB = slope BC), angle between two lines (tan θ = |(m₁ − m₂)/(1 + m₁m₂)|), perpendicular bisectors, and more.

Data analysts and economics students who interpret slopes of linear regression lines (the slope of sales vs. advertising spend represents rupees of sales per rupee of advertising).

Civil and structural engineers computing road gradients, drainage slopes, and ramp inclines. An incline with slope 1/20 (0.05) corresponds to an angle of arctan(0.05) ≈ 2.86°, our calculator gives this angle directly.

Physics students who interpret slope in position-time graphs (slope = velocity), velocity-time graphs (slope = acceleration), and force-displacement graphs (slope = spring constant k in Hooke's Law).

What Insights Does the Slope Calculator Give You?

Slope (m), the primary result. Positive: line rises left to right. Negative: line falls. Zero: horizontal. "Undefined" (with special handling): vertical line. The magnitude tells you the steepness, slope 10 is much steeper than slope 0.5.

Linear Equation, automatically written as y = mx + b with correct sign handling. For a vertical line (x₁ = x₂), the equation is x = c instead. Pipe this equation directly into further coordinate geometry problems.

Y-Intercept (b), the y-coordinate where the line crosses the y-axis (when x = 0). For vertical lines, the y-intercept is undefined and the calculator instead shows the x-intercept (x = c).

Angle of Inclination (°), the angle the line makes with the positive x-axis. Ranges from 0° (horizontal) to just under 180° for steeply falling lines, with 90° reserved for vertical lines. Useful when converting between slope and angle for construction or navigation contexts.

Distance between Points, the straight-line distance from (x₁, y₁) to (x₂, y₂), computed as √((Δx)² + (Δy)²). This is the length of the line segment between the two input points.

Direction Label, "↗ Rising" (m > 0), "↘ Falling" (m < 0), "→ Horizontal" (m = 0), or "↕ Vertical" (undefined slope). Provides an immediate directional check before working with the numerical slope.

How to use this Slope calculator

  1. Enter Point 1 coordinates, type the x₁ and y₁ values. Accepts positive, negative, and decimal values. For the origin, enter (0, 0).

  2. Enter Point 2 coordinates, type x₂ and y₂. Ensure the two points are different (x₁ ≠ x₂ or y₁ ≠ y₂); entering the same point twice is undefined.

  3. Read the Slope, the primary result card shows slope m to four decimal places (or "Undefined" for a vertical line). Check the direction label to confirm the sign is as expected.

  4. Read the Equation, the linear equation y = mx + b (or x = c) is displayed. Use this to evaluate y at any x, or to find the intersection with another line by solving simultaneously.

  5. Check Angle and Distance, the inclination angle and point-to-point distance appear in secondary cards. The angle is useful for physical slope contexts (ramps, roads, roof pitch). The distance is useful for any problem involving the length of the line segment between your two points.

Formula & Methodology

Slope:m = (y₂ − y₁) / (x₂ − x₁)[Undefined if x₁ = x₂]

Y-Intercept:b = y₁ − m × x₁

Angle of Inclination:θ = arctan(m) in degrees[θ = 90° for vertical lines]

Distance between Points:d = √((x₂ − x₁)² + (y₂ − y₁)²)

Line Equation:Slope-intercept: y = mx + bVertical line: x = x₁

Worked example, finding the slope of a road gradient:

A road survey measures two points on a road: (0, 0) and (200, 14) in metres (x = horizontal distance, y = elevation).

Step 1, Slope:m = (14 − 0) / (200 − 0) = 14/200 = 0.07

Step 2, Gradient percentage: 0.07 × 100 = 7% gradient (the road rises 7 m per 100 m horizontal, steep for Indian highway standards, which typically cap at 5–6% in hilly terrain)

Step 3, Angle of inclination:θ = arctan(0.07) ≈ 4.00°

Step 4, Distance along road (the actual road length, not just horizontal):d = √(200² + 14²) = √(40000 + 196) = √40196 ≈ 200.49 m

Step 5, Line equation:y = 0.07x + 0 → y = 0.07x (the road passes through the origin)

Assumption: The slope formula assumes a straight line (linear relationship) between the two points. For curved paths (curves, arcs, or non-linear functions), the slope between two points is the secant slope, the instantaneous slope at a single point requires calculus (the derivative). Coordinates can be in any consistent unit, metres, kilometres, or dimensionless values, as long as both axes use the same unit.

Frequently Asked Questions

Slope (also called gradient) measures the steepness and direction of a straight line. It is defined as the ratio of vertical change (rise) to horizontal change (run) between any two points on the line: slope m = (y₂ − y₁) / (x₂ − x₁). A positive slope means the line rises left to right; a negative slope means it falls. A slope of 0 indicates a horizontal line; an undefined slope (division by zero) indicates a vertical line.
Given two points (x₁, y₁) and (x₂, y₂), the slope is m = (y₂ − y₁) / (x₂ − x₁). For points (2, 3) and (6, 11): m = (11 − 3) / (6 − 2) = 8 / 4 = 2. This means for every 1 unit moved right along the x-axis, the line rises 2 units. The order of the points does not matter, swapping point 1 and point 2 gives the same slope (both numerator and denominator flip sign, cancelling out).
Once the slope m is known, the equation of the line can be written in slope-intercept form: y = mx + b, where b is the y-intercept. The y-intercept is found by substituting one known point: b = y₁ − m × x₁. For slope m = 2 through point (2, 3): b = 3 − 2 × 2 = −1. The equation is y = 2x − 1. Our calculator computes both the slope and y-intercept automatically and builds the equation string.
The Slope Calculator takes two coordinate pairs (x₁, y₁) and (x₂, y₂) and computes: slope m = (y₂−y₁)/(x₂−x₁); y-intercept b; the angle of inclination in degrees; the distance between the two points; and the linear equation in the form y = mx + b (or x = c for vertical lines). It also identifies whether the line is rising, falling, horizontal, or vertical.
The angle of inclination is the angle θ between the line and the positive x-axis, measured counterclockwise. It is related to slope by m = tan(θ). For slope m = 1, θ = 45°. For slope m = 0 (horizontal line), θ = 0°. For undefined slope (vertical line), θ = 90°. The angle is always in the range [0°, 90°] for positive slopes and (90°, 180°) for negative slopes when measured from the positive x-axis.
The distance between two points (x₁, y₁) and (x₂, y₂) is computed using the Pythagorean theorem: d = √((x₂−x₁)² + (y₂−y₁)²). The horizontal and vertical differences form the legs of a right triangle, and the distance is the hypotenuse. For points (2, 3) and (6, 6): d = √((6−2)² + (6−3)²) = √(16+9) = √25 = 5. Use the [Pythagorean Theorem Calculator](/pythagorean-theorem-calculator/) to explore right triangles formed by coordinate differences.
Yes, slope (gradient) is covered in CBSE Class 11 Mathematics under Chapter 10 (Straight Lines), where students learn the slope formula, conditions for parallel and perpendicular lines (m₁ = m₂ for parallel; m₁ × m₂ = −1 for perpendicular), and various forms of the line equation (slope-intercept, point-slope, intercept form). It is also a fundamental concept in coordinate geometry for JEE Main and JEE Advanced, where slope-related problems are common.
Two lines are parallel if and only if they have the same slope: m₁ = m₂. Two lines are perpendicular if and only if their slopes are negative reciprocals of each other: m₁ × m₂ = −1 (or equivalently m₂ = −1/m₁). A line with slope 3 is perpendicular to a line with slope −1/3. Horizontal lines (m = 0) are perpendicular to vertical lines (undefined slope). These conditions are frequently tested in CBSE Class 11 and JEE coordinate geometry.
Slope appears in many practical contexts: road gradient (a gradient of 1:20 means the road rises 1 m for every 20 m of horizontal distance); roof pitch (expressed as rise over run, e.g., 4:12); wheelchair ramp accessibility (the ADA standard recommends a maximum slope of 1:12 = 8.33%); and rate of change in data analysis (the slope of a best-fit line in a scatter plot tells you the rate of change of the y-variable per unit of x). In Indian construction, slope is used for drainage gradients and road design.
When x₁ = x₂, the two points have the same x-coordinate and define a vertical line. The slope formula gives (y₂ − y₁) / 0, which is undefined (division by zero). The equation of a vertical line is x = c (a constant), not y = mx + b. Our calculator detects this case, displays the slope as Undefined, shows the equation as x = [value], and the angle of inclination as exactly 90°. The distance between the two points is simply |y₂ − y₁|.
The Slope Calculator focuses on slope, intercept, angle, and distance, it does not directly compute the midpoint. The midpoint formula is M = ((x₁+x₂)/2, (y₁+y₂)/2). You can compute this manually from your two known points. For example, the midpoint of (2, 3) and (6, 11) is ((2+6)/2, (3+11)/2) = (4, 7). The midpoint lies on the line y = 2x − 1 computed from those same points: y = 2(4) − 1 = 7 ✓.
Also known as
slope of a line calculatorgradient calculatorrise over runslope formulaline slope