Slope Calculator
The slope of a line measures its steepness and direction, defined as the ratio of vertical change (rise) to horizontal change (run) between any two points. Given two points (x₁, y₁) and (x₂, y₂), the slope m = (y₂ − y₁) / (x₂ − x₁) tells you how many units the line rises or falls for each unit moved horizontally.
This calculator also derives the full equation of the line in slope-intercept form (y = mx + b), the angle of inclination in degrees, the y-intercept, and the straight-line distance between the two points. Vertical lines (x₁ = x₂) are handled as a special case with undefined slope.
How it works
m = (y₂ − y₁) / (x₂ − x₁); b = y₁ − m·x₁; angle θ = arctan(m) in degrees; distance = √((x₂−x₁)² + (y₂−y₁)²). For vertical lines (x₁ = x₂), slope is undefined and the equation is x = x₁.
Use cases
- Finding the gradient of a road, ramp, or roof pitch in civil engineering
- Determining the equation of a line through two points in algebra class
- Calculating the angle of a ski slope or hiking trail
- Analyzing trends in data by fitting a line through two reference points
- Computing the distance between two coordinates on a map or grid