Roboculator
Online CalculatorsCategoriesDate & EventsNews
Get Started
Online CalculatorsCategoriesDate & EventsNewsGet Started
Roboculator

Smart calculators for every challenge. Free, fast, and private.

Categories

  • Finance
  • Health
  • Math
  • Construction
  • Conversion
  • Everyday Life

Popular Tools

  • Date & Events
  • Loan Calculator
  • BMI Calculator
  • Percentage Calc
  • Latest News
  • Search All

Resources

  • Glossary
  • Topic Tags
  • News & Insights

Company

  • About
  • Contact

Legal

  • Privacy Policy
  • Terms of Service
  • Editorial Policy
  • Disclaimer
© 2026 Roboculator. All rights reserved.
Roboculator

roboculator.com

  1. Home
  2. /Math
  3. /Coordinate Geometry Calculators
  4. /Line Equation from Two Points Calculator

Line Equation from Two Points Calculator

Last updated: March 15, 2026

Calculator

Results

Rise (Δy)

6

Run (Δx)

3

Distance Between Points

6.708204

Midpoint x

2.5

Midpoint y

5

Slope (m)

2

Y-Intercept (b)

2.222222e-10

Angle with x-axis

—

deg

Vertical Line Flag

0

Horizontal Line Flag

0

Same Point Flag

0

X-Intercept

-1.111111e-10

Results

Rise (Δy)

6

Run (Δx)

3

Distance Between Points

6.708204

Midpoint x

2.5

Midpoint y

5

Slope (m)

2

Y-Intercept (b)

2.222222e-10

Angle with x-axis

—

deg

Vertical Line Flag

0

Horizontal Line Flag

0

Same Point Flag

0

X-Intercept

-1.111111e-10

The Line Equation from Two Points Calculator determines the equation of a straight line passing through two given points $$(x_1, y_1)$$ and $$(x_2, y_2)$$. This is one of the most fundamental operations in coordinate geometry and serves as the basis for countless applications in engineering, physics, data analysis, and computer graphics.

The slope of a line through two points is given by:

$$m = \frac{y_2 - y_1}{x_2 - x_1}$$

Once the slope $$m$$ is known, the slope-intercept form $$y = mx + b$$ is obtained by substituting one of the points to solve for $$b$$:

$$b = y_1 - m \cdot x_1$$

The slope represents the rate of change of $$y$$ with respect to $$x$$. A positive slope means the line rises from left to right, while a negative slope means it falls. A slope of zero indicates a horizontal line, and an undefined slope (when $$x_1 = x_2$$) indicates a vertical line.

Alternatively, the line can be expressed using the point-slope form:

$$y - y_1 = m(x - x_1)$$

or the two-point form:

$$\frac{y - y_1}{y_2 - y_1} = \frac{x - x_1}{x_2 - x_1}$$

This calculator also computes several auxiliary quantities. The distance between the two points is given by the Euclidean distance formula:

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

The midpoint of the segment connecting the two points is:

$$M = \left(\frac{x_1 + x_2}{2},\; \frac{y_1 + y_2}{2}\right)$$

The angle that the line makes with the positive x-axis is computed via the arctangent function:

$$\theta = \arctan\left(\frac{y_2 - y_1}{x_2 - x_1}\right)$$

Finding the equation of a line through two points is essential in linear regression, where a best-fit line approximates data trends. In computer graphics, line rasterization algorithms require the slope to determine which pixels to illuminate. In physics, the slope of a position-time graph gives velocity, and the slope of a velocity-time graph gives acceleration. Surveyors use line equations to describe property boundaries and road grades. Financial analysts plot trend lines through price data to forecast market movements.

The rise $$\Delta y = y_2 - y_1$$ and run $$\Delta x = x_2 - x_1$$ decompose the slope into its vertical and horizontal components, which is particularly intuitive for understanding gradients in civil engineering (e.g., road grade expressed as rise over run). Understanding these components helps in converting between slope representations such as percentage grade, angle of inclination, and ratio notation.

Visual Analysis

How It Works

Enter the coordinates of two distinct points. The calculator computes the slope $$m = \Delta y / \Delta x$$, the y-intercept $$b = y_1 - m \cdot x_1$$, the distance between the points, the midpoint, and the angle of inclination. If the two x-coordinates are equal, the line is vertical and the slope is undefined.

Understanding Your Results

The slope tells you how steeply the line rises or falls. The y-intercept is where the line crosses the y-axis. Together they give the equation $$y = mx + b$$. The distance and midpoint describe the segment between your two points, and the angle shows the line's orientation relative to the horizontal.

Worked Examples

Basic Positive Slope

Inputs

x11
y12
x24
y28

Results

slope2
y intercept0
rise6
run3
distance6.7082
midpoint x2.5
midpoint y5
angle deg63.4349

The line y = 2x passes through the origin with a slope of 2. The distance between (1,2) and (4,8) is √45 ≈ 6.71.

Negative Slope Line

Inputs

x1-2
y15
x23
y2-5

Results

slope-2
y intercept1
rise-10
run5
distance11.1803
midpoint x0.5
midpoint y0
angle deg-63.4349

The line y = -2x + 1 falls from left to right. The midpoint lies on the x-axis at (0.5, 0).

Frequently Asked Questions

When $$x_1 = x_2$$, the denominator $$\Delta x = 0$$ and the slope is undefined. The line is vertical, described by the equation $$x = x_1$$. The calculator will report an infinite slope in this case.

This calculator handles exactly two points to define a unique line. For three or more points that may not be collinear, you would use linear regression (least-squares fitting) to find the best-fit line.

From $$y = mx + b$$, rearrange to $$mx - y + b = 0$$ or equivalently $$Ax + By + C = 0$$ where $$A = m$$, $$B = -1$$, $$C = b$$. Multiply through by any constant to clear fractions if desired.

A slope of zero means the line is perfectly horizontal: $$y = b$$ for all $$x$$. The two points have the same y-coordinate.

The angle is measured counterclockwise from the positive x-axis to the line, ranging from $$-90°$$ to $$90°$$. A positive angle indicates the line rises to the right; a negative angle indicates it falls.

Yes, the Euclidean distance formula $$d = \sqrt{\Delta x^2 + \Delta y^2}$$ is a direct application of the Pythagorean theorem, treating $$\Delta x$$ and $$\Delta y$$ as the legs of a right triangle.

Sources & Methodology

Stewart, J. Calculus: Early Transcendentals. Cengage Learning. Anton, H. Elementary Linear Algebra. Wiley. Larson, R. & Edwards, B. Calculus. Cengage Learning.
R

Roboculator Team

The Roboculator Team explains calculations, planning tools, and practical formulas in clear language for real-life situations.

How helpful was this calculator?

Be the first to rate!

Related Calculators

Distance Calculator (2D)

Coordinate Geometry Calculators

Distance Calculator (3D)

Coordinate Geometry Calculators

Midpoint Calculator

Coordinate Geometry Calculators

Endpoint Calculator

Coordinate Geometry Calculators

Slope Calculator

Coordinate Geometry Calculators

Slope Intercept Form Calculator

Coordinate Geometry Calculators