Connect via MCP →

Enter Calculation

Formula

Advertisement

Results

Length of the Line Segment
5
units
Horizontal change (Δx = x₂ − x₁) 3
Vertical change (Δy = y₂ − y₁) 4

What Is the Length of a Line Segment?

A line segment is the portion of a straight line bounded by two endpoints. Its length is simply the straight-line distance between those two endpoints. When the points are given as coordinates in the Cartesian plane, you can find this length exactly using the distance formula, which is a direct application of the Pythagorean theorem.

A line segment between two labeled points on a coordinate plane
A line segment connecting points (x₁,y₁) and (x₂,y₂) on the coordinate plane.

How to Use This Calculator

Enter the coordinates of the first endpoint as (x₁, y₁) and the second endpoint as (x₂, y₂). The calculator subtracts the coordinates to find the horizontal change (Δx) and vertical change (Δy), squares each, adds them, and takes the square root to return the segment length. Coordinates can be positive, negative, or decimal values.

The Formula Explained

The length is given by:

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

The differences \((x_2 - x_1)\) and \((y_2 - y_1)\) form the two legs of a right triangle, and the segment itself is the hypotenuse. Squaring removes any negative signs, so the order in which you subtract does not affect the result.

Right triangle showing horizontal and vertical legs forming the distance formula
The distance formula comes from the Pythagorean theorem using the horizontal and vertical differences.

Worked Example

Find the length between A(1, 2) and B(4, 6). Here \(\Delta x = 4 - 1 = 3\) and \(\Delta y = 6 - 2 = 4\). So $$L = \sqrt{3^2 + 4^2} = \sqrt{9 + 16} = \sqrt{25} = 5 \text{ units}.$$ This is the classic 3-4-5 right triangle.

FAQ

Does the order of the points matter? No. Swapping the two endpoints flips the signs of \(\Delta x\) and \(\Delta y\), but squaring them produces the same length.

What units does the result use? The result is in the same units as your coordinates. If the axes are in centimeters, the length is in centimeters.

Can I use negative coordinates? Yes. The subtraction handles negative values correctly, for example from (−2, −1) to (2, 2).

Last updated: