Find the straight-line distance between two points in two or three dimensions, exactly when the result is a whole number.
Slope Calculator
Find the slope of the line through two points, with its equation and angle, reporting a vertical line as vertical rather than as infinity.
- Free
- No sign-up
- Runs in your browser
Input
A whole number, a decimal, or a fraction such as 3/4. Arithmetic is exact, so fractions stay exact.
A whole number, a decimal, or a fraction such as 3/4. Arithmetic is exact, so fractions stay exact.
A whole number, a decimal, or a fraction such as 3/4. Arithmetic is exact, so fractions stay exact.
A whole number, a decimal, or a fraction such as 3/4. Arithmetic is exact, so fractions stay exact.
How many digits to show when the answer is irrational. An exact answer ignores this.
Ready
Everything happens on this device. No upload, no account, no network request.
How to use this tool
- 1
Enter two points.
- 2
The slope, the equation of the line, its y-intercept, its angle and the perpendicular slope all appear.
Questions about Slope Calculator
What is the slope of a vertical line?
It does not have one. The run is zero and division by zero has no value, so the slope is undefined - not infinity. Infinity is not a number, and a tool that returns it hands a later calculation something that turns into NaN. A vertical line is still a perfectly good line; its equation is written as x = c, which is what the tool reports.
How do I find a perpendicular slope?
Take the negative reciprocal: a line of slope 3 has perpendiculars of slope -1/3, because the product of perpendicular slopes is -1. The exceptions are the horizontal and vertical cases - a horizontal line has slope 0 and its perpendiculars are vertical, with no slope at all.
Why is the angle sometimes negative?
The angle is measured anticlockwise from the positive x-axis, so a line falling left to right has a negative angle. A slope of -1 gives -45 degrees, which is the same line as 135 degrees.
Is my data sent anywhere?
No. This runs as JavaScript in your browser tab: there is no network request carrying your numbers, nothing reaches a server log, and it keeps working with your connection off. You can confirm it in the browser’s network panel.
Does the Slope Calculator work offline?
Yes. Once the page has loaded it runs entirely as JavaScript on your own device, so the Slope Calculator keeps working with the network switched off and nothing is ever sent to a server.
Related tools
Other tools you might reach for next.
Find the midpoint of two points exactly, in two or three dimensions.
Solve a right triangle for the hypotenuse or a missing leg, reported exactly for a Pythagorean triple.
Evaluate an expression with exact fraction arithmetic, trigonometry, logarithms and factorials, reporting whether the result is exact.
Reduce a fraction to lowest terms, with its mixed number and exact decimal form including any repeating block.
Add two fractions exactly, showing the common denominator step and reducing the result.
Subtract one fraction from another exactly, showing the common denominator step.
Multiply two fractions exactly, multiplying across and reducing the result.