Skip to content

Slope Calculator — Step-by-Step Solutions

m=y2−y1x2−x1m = \frac{y_2 - y_1}{x_2 - x_1}

Your calculations will appear here

The Slope Calculator finds the slope of a line given two points. It also provides the equation of the line in slope-intercept form (y = mx + b) and point-slope form, along with the distance between the two points.

Enter the coordinates of two points (x₁, y₁) and (x₂, y₂) to calculate the slope and line equation instantly.

How to Use the Slope Calculator

  1. Two Points mode: enter the coordinates of two points (x1, y1) and (x2, y2). The calculator finds the slope, y-intercept, line equation, and distance between the points.
  2. Point + Slope mode: enter a single point and a known slope value. The calculator derives the full equation in both point-slope and slope-intercept form.
  3. Slope-Intercept mode: enter the slope (m) and y-intercept (b) directly. The calculator writes the equation, finds the x-intercept, and generates two sample points for plotting.
  4. Parallel / Perpendicular mode: enter the slope and y-intercept of an existing line, plus a point. The calculator finds both the parallel line (same slope) and the perpendicular line (negative reciprocal slope) that pass through that point.

Formula and Theory

The slope of a line measures its steepness and direction. It is defined as the ratio of the vertical change (rise) to the horizontal change (run) between any two points on the line. A positive slope means the line goes upward from left to right, a negative slope means it goes downward, a slope of zero produces a horizontal line, and an undefined slope (division by zero) produces a vertical line.

The slope-intercept form y = mx + b is the most common way to express a linear equation, where m is the slope and b is the y-intercept. The point-slope form y - y1 = m(x - x1) is useful when you know one point and the slope. Both forms describe the same line and can be converted between each other algebraically.

Parallel lines have identical slopes but different y-intercepts. Perpendicular lines have slopes that are negative reciprocals of each other, meaning their product equals -1. These relationships are fundamental in coordinate geometry and are used extensively in engineering, physics, and computer graphics.

Worked Examples

Example 1: Finding slope from two points

Problem: Find the slope of the line through (1, 2) and (4, 8).

Solution: m = (8 - 2) / (4 - 1) = 6 / 3

Answer: The slope is 2. The equation is y = 2x + 0, or simply y = 2x.

Example 2: Equation from a point and slope

Problem: A line passes through (3, 5) with a slope of -2. Find its equation.

Solution: Point-slope form: y - 5 = -2(x - 3). Expanding: y - 5 = -2x + 6. Solving: y = -2x + 11.

Answer: The equation is y = -2x + 11, with a y-intercept of 11.

Example 3: Finding intercepts from slope-intercept form

Problem: Given m = 3 and b = -6, find the x-intercept.

Solution: Set y = 0: 0 = 3x - 6. Solving: 3x = 6, so x = 2.

Answer: The x-intercept is at (2, 0). The equation is y = 3x - 6.

Example 4: Parallel and perpendicular lines

Problem: Find lines parallel and perpendicular to y = 4x + 1 that pass through (2, 3).

Solution: Parallel: same slope m = 4. Using 3 = 4(2) + b gives b = -5, so y = 4x - 5. Perpendicular: m = -1/4. Using 3 = -1/4(2) + b gives b = 3.5, so y = -0.25x + 3.5.

Answer: The parallel line is y = 4x - 5. The perpendicular line is y = -0.25x + 3.5.

Frequently Asked Questions

What does it mean when the slope is undefined?
An undefined slope occurs when the two points have the same x-coordinate, making the denominator zero in the slope formula. This represents a vertical line, which cannot be expressed in y = mx + b form. Instead it is written as x = k, where k is the shared x-coordinate.
How do I tell whether two lines are parallel or perpendicular?
Two lines are parallel if they have exactly the same slope. Two lines are perpendicular if the product of their slopes equals -1 (one slope is the negative reciprocal of the other). For example, slopes of 3 and -1/3 are perpendicular because 3 times -1/3 equals -1.
What is the difference between point-slope form and slope-intercept form?
Point-slope form is y - y1 = m(x - x1) and is most useful when you know a specific point on the line and the slope. Slope-intercept form is y = mx + b and directly shows the slope and where the line crosses the y-axis. They describe the same line and you can convert between them by expanding and simplifying.
Can the slope be a fraction or a decimal?
Yes. Slope can be any real number, including fractions and decimals. A slope of 1/3 means the line rises 1 unit for every 3 units it moves to the right. The calculator handles fractional and decimal slopes in all modes.
How is slope used in real life?
Slope appears in many practical contexts. Road gradients are expressed as a percentage slope (a 6% grade rises 6 metres for every 100 metres horizontally). Roof pitch, wheelchair ramp requirements, and drainage angles all rely on slope calculations. In economics, slope represents the rate of change, such as cost per unit or speed.

Related Algebra Calculators

Related Articles