Slope calculator
Get slope, y-intercept, distance and direction angle from two points; (0, 1) and (2, 5) give m = 2 and b = 1.
- Runs in your browser
- No upload
- Instant result
Assumptions & formula
Formula and assumptions
m=(y₂−y₁)/(x₂−x₁); b=y₁−mx₁
Results
Enter values and press Calculate to see the result here.
How to use this calculator
- Set inputs and units
Enter (x₁, y₁) and (x₂, y₂) as two distinct points. Negative coordinates and decimals are allowed. Keep each x paired with its own y value and use the same scale on both axes when interpreting distance or angle.
- Calculate
Check this worked example: (0,1), (2,5) → slope=(5−1)/(2−0)=2; intercept=1; y=2x+1
- Results
Slope is the change in y per unit of x: positive rises from left to right, negative falls, and zero is horizontal. The intercept b gives y=mx+b. The direction angle points from the first point to the second; reversing the points keeps the slope and distance but changes that angle by 180°. It can differ from the usual inclination angle of the undirected line.
Questions and limits
What happens on a vertical line?
Equal x coordinates with different y values give x=constant and an undefined slope. It is not an ordinary finite line y=mx+b.
Which input errors should I correct?
Identical points don't define a single line. Correct the coordinates you copied instead of forcing a denominator.
What does this calculation leave out?
Two-point geometry only. There is no regression, no model of measurement uncertainty, and no geodesic distance for latitude and longitude.