HomeCalculatorsMathSlope Calculator

Slope Calculator

Math

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

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.

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
What is slope and how is it defined?
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.
How do you calculate the slope between two points?
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).
What is the equation of a line given its slope?
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.
What does the Slope Calculator compute?
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.
What is the angle of inclination of a line?
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.
What is the distance between two points?
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.
Is slope part of the CBSE Mathematics syllabus?
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.
What are parallel and perpendicular lines in terms of slope?
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.
How is slope used in real life?
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.
What happens when x₁ equals x₂ in slope calculation?
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₁|.
How do I find the midpoint of a line segment using the Slope Calculator?
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 ✓.