Slope Calculator

Calculate the slope of a line between two points. Free online slope calculator with graph visualization, intercept, and step-by-step solutions.

Input Coordinates
P₁ (x₁, y₁)
P₂ (x₂, y₂)
Results
Enter coordinates and click Calculate to see the detailed steps.
100% client-side — nothing leaves your browserLive results — no page reloadsFree, no signup, no limits

Recent Calculations

No calculations yet — your last 6 will show up here.

Slope Calculator

This free online slope calculator computes the slope, angle, distance, and equation of a line between any two points $(x_1, y_1)$ and $(x_2, y_2)$ instantly in your browser, with an interactive graph and no server uploads.

What is Slope? The slope of a line, often denoted by $m$, is a measure of how steep a line is. It describes both the direction and the steepness of the line. The slope is calculated as the ratio of the vertical change (rise) to the horizontal change (run) between two distinct points on the line:

$$m = \frac{\text{rise}}{\text{run}} = \frac{\Delta y}{\Delta x} = \frac{y_2 - y_1}{x_2 - x_1}$$

A line with positive slope rises as it moves from left to right. A line with negative slope falls as it moves from left to right. A horizontal line has slope $0$, and a vertical line has an undefined slope.

Line Equation The equation of a straight line is most commonly expressed in slope-intercept form:

$$y = mx + b$$

where $m$ is the slope and $b$ is the $y$-intercept (where the line crosses the $y$-axis). Given two points, the slope is calculated first, then the $y$-intercept is found by substituting one point into the equation: $b = y - mx$.

Distance Between Points The Euclidean distance between two points is given by the formula:

$$d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}$$

This is derived from the Pythagorean theorem and represents the length of the straight line segment connecting the two points.

Angle of the Line The angle the line makes with the horizontal x-axis is:

$$\theta = \arctan(|m|)$$

This can also be expressed as a percentage grade: $\text{grade} = m \times 100\%$.

Applications Slope calculations are used across many fields: civil engineering (road grades, roof pitches), physics (velocity as a slope of position vs. time), economics (marginal rates), data science (linear regression), and everyday life (ramp inclines, stair rises).
Interactive Graph The built-in canvas graph plots both points, draws the connecting line, and visualizes the rise and run. The graph adapts to your coordinate values and updates in real time.
Privacy & Performance All calculations run locally in your browser. No data is transmitted, logged, or stored on any server. Results appear instantly with no page reloads.
🔒 Client-side only⚡ Web Worker processing🌐 Works offline🛡️ Zero server logs

Frequently Asked Questions

Got questions about slope, linear equations, or how to use this tool? We've got answers.

What is the slope of a line?

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: $m = \frac{\text{rise}}{\text{run}} = \frac{\Delta y}{\Delta x} = \frac{y_2 - y_1}{x_2 - x_1}$. A positive slope means the line rises from left to right, while a negative slope means it falls.

What does the slope-intercept form tell us?

The slope-intercept form $y = mx + b$ gives two key properties of a line at a glance: $m$ is the slope (steepness and direction), and $b$ is the y-intercept (where the line crosses the y-axis). For example, $y = 2x + 3$ has a slope of 2 and crosses the y-axis at $(0, 3)$.

What happens when a line is vertical or horizontal?

A horizontal line has an equation of the form $y = b$ (slope $m = 0$), since there is no vertical change. A vertical line has an equation of the form $x = a$ (slope is undefined), since division by zero occurs when calculating its slope. The angle of a horizontal line is $0°$, while a vertical line has an angle of $90°$.

How do I calculate the angle of a line?

The angle of a line relative to the horizontal (x-axis) is given by $\theta = \arctan(|m|)$ in radians, or $\theta = \arctan(|m|) \cdot \frac{180}{\pi}$ in degrees. For a slope of $m = 1$, the angle is $45°$. The angle can also be expressed as a percentage grade — a $100\%$ grade corresponds to a $45°$ angle.

How are parallel and perpendicular lines related by slope?

Two lines are parallel if they have the same slope ($m_1 = m_2$) but different y-intercepts. Two lines are perpendicular if the product of their slopes equals $-1$ ($m_1 \cdot m_2 = -1$), meaning one slope is the negative reciprocal of the other. For example, slopes of $2$ and $-\frac{1}{2}$ produce perpendicular lines.

What is the difference between slope and grade?

Slope is typically expressed as a decimal or fraction ($m = \Delta y / \Delta x$). Grade (or slope percentage) multiplies this by 100: $\text{grade} = m \times 100\%$. A slope of 0.05 corresponds to a 5% grade, meaning the elevation changes 5 units vertically for every 100 units horizontally.

Is this calculator private?

Yes. All calculations run locally in your browser. No data is transmitted, logged, or stored on any server. The graph is rendered entirely on your device using the HTML5 Canvas API.