Slope Calculator
Enter two points, a rise and a run, or the constants in y = mx + b. The calculator returns the slope m = (y₂ − y₁)/(x₂ − x₁), the angle with the positive x-axis, and, for two points, the intercept and the equation of the line. A vertical line (a run of zero with a changing y) is reported as undefined. This is the slope of a graph, not a roof: use the roof pitch calculator for a rise-in-12 and a materials slope factor.
Slope calculator
On this calculator: Ctrl+Enter copies the result, Shift+Alt+L copies a link to the current inputs, Shift+Alt+R resets, Shift+Alt+P opens Print / Save PDF. These shortcuts do not run while you type in a field, except Ctrl+Enter.
Saved results on this device
Stored only in this browser, not on our servers.
How to use the slope calculator – two points, rise and run, y = mx + b
- Choose how you will enter the line. Two points, a rise and a run, or the slope and intercept of y = mx + b.
- Type the numbers. Coordinates may be negative. A run of zero with a different y is a vertical line, and the slope is undefined.
- Read the slope. m is returned with the angle arctan(m) in degrees. Two-point mode also gives the y-intercept and the equation.
- Do not confuse this with roof pitch. A roof in “6 in 12” is a different unit system. Switch to the roof pitch calculator for that job.
Formulas on this page
The slope of a non-vertical straight line is the ratio of the vertical change to the horizontal change:
m = (y₂ − y₁) / (x₂ − x₁) = rise / run.
The angle with the positive x-axis is θ = arctan(m), returned in degrees. Through two points the intercept is b = y₁ − m x₁, and the line is y = mx + b. The distance between the points is √((x₂ − x₁)² + (y₂ − y₁)²), which is also the hypotenuse of a rise-run right triangle.
A run of zero with a changing y is a vertical line; the slope is undefined and no equation of the form y = mx + b exists. Two identical points do not determine a line either. Those cases return a plain-language error rather than Infinity.
A graph slope is not a roof pitch
Searchers often want a roof when they type “slope calculator”. A roof pitch of 6 in 12 is a rise of 6 units in a run of 12, which is the number 0.5, but roof tools also report an angle, a slope factor for shingles, and a plan-to-surface conversion. That work already lives on the roof pitch calculator. This page stays with school and college coordinate geometry so that (0, 0) and (4, 2) always give m = 1/2, without a “in 12” unit.
The triangle calculator solves a triangle from sides and angles. The quadratic calculator sketches y = ax² + bx + c, whose tangent slope at a point is the derivative 2ax + b, which is a different question and is not computed here.
Worked figures
- (0, 0) and (4, 2): m = 1/2, θ ≈ 26.565°, equation y = 0.5x, distance √20 ≈ 4.472.
- (1, 2) and (1, 5): undefined (vertical).
- Rise 3, run 4: m = 0.75, θ ≈ 36.870°, hypotenuse 5.
- y = 2x + 1 at x = 3: y = 7, θ ≈ 63.435°.
Those identities are unit-tested against the same TypeScript functions the browser runs. Copy result, Copy link, Reset and Save this result work as on the other GenericCalc tools. Report a mistake from the about box if a figure disagrees with a hand check.
Frequently asked questions
What is the slope between (0, 0) and (4, 2)?
m = (2 − 0)/(4 − 0) = 0.5. The angle with the positive x-axis is arctan(0.5) ≈ 26.565°, and the line is y = 0.5x. That is the default two-point example.
What is the slope of rise 3 and run 4?
m = 3/4 = 0.75. The hypotenuse of that right triangle is 5, and the angle is arctan(0.75) ≈ 36.870°.
When is the slope undefined?
When the run is zero and the two y-values differ: a vertical line. If the two points are identical, there is no unique line.
Is this the same as a roof pitch?
No. Roof pitch is usually written as rise over 12 (and sometimes as an angle or a slope factor for materials). This page is the coordinate-plane slope m. The two calculators are cross-linked so you can jump if you meant the other one.
Can the slope be negative?
Yes. A line that falls as x increases has a negative m, and the angle with the positive x-axis is negative.
How is the angle measured?
It is arctan(m) in degrees, so it lies between −90° and 90°. A vertical line has no finite angle on this page.
Does y = mx + b accept a point?
You can optionally type an x and the calculator will evaluate y at that x. The slope and intercept themselves come from the m and b you entered.
Related calculators
Quadratic Formula Calculator – Roots of ax² + bx + c = 0
Roots, discriminant and vertex of ax² + bx + c = 0, including complex roots.
Roof Pitch Calculator
Rise and run to x/12, degrees, percent and slope factor.
Triangle Calculator – SSS, SAS, ASA, AAS, SSA and Pythagorean
Solve a triangle from SSS, SAS, ASA, AAS, SSA or the Pythagorean theorem.
Percentage Calculator – What Is X% of Y?
X% of Y, X is what % of Y, and X is Y% of what number.
Area Calculator – Rectangle, Triangle, Circle and More
Area of rectangles, triangles, circles, ellipses, trapezoids and rings from side lengths.
Sources and references
About this calculator
Written and maintained by Rashid Mehmood, founder of CalcTen. The formulas are unit-tested against hand-worked examples, and the content is reviewed whenever product sizes or guidance change. Last updated and reviewed 15 November 2026. See our editorial policy. If you spot a mistake, report it.
Results are calculated from the numbers you enter and shown with the working. Rounding is applied only when displaying results. Grade and GPA scales, and weighting rules, vary by school, so confirm with your institution. Read the disclaimer.