Distance Calculator

Find the straight-line distance between two points on a Cartesian plane.

yx(x₁, y₁)(x₂, y₂)

2D distance formula

d = (x₂ − x₁)² + (y₂ − y₁)²

Enter two points on a Cartesian plane

Point 1 (P₁)

Point 2 (P₂)

What is a 2D distance calculator?

A 2D distance calculator returns the straight-line gap between two points on a flat Cartesian plane. Subtract the x-coordinates to get the horizontal leg Δx, subtract the y-coordinates to get the vertical leg Δy, and the segment connecting the points is the hypotenuse of the right triangle they form. The Pythagorean theorem then gives d = √[(x₂ − x₁)² + (y₂ − y₁)²] in a single closed-form expression — the same formula every coordinate-geometry textbook spells out.

Knowing the distance is only half the story. The same two points also pin down a midpoint that lies exactly halfway between them, a slope m = Δy/Δx that describes how steeply the line rises, an angle of inclination θ = arctan(m) measured against the +x axis, and the equation of the unique line through both points in three canonical forms — slope-intercept y = mx + b, point-slope y − y₁ = m(x − x₁), and standard Ax + By + C = 0. This calculator returns every one of those quantities together so a single Calculate press answers the whole family of questions a coordinate-geometry problem typically asks.

How the 2D distance calculator works

Enter two points

Type the x and y coordinates of point 1 and point 2. Negative values and decimals are accepted; the calculator uses the exact values you enter without any rounding.

Read the headline

The distance is shown as both a decimal and a simplified-radical exact form (e.g. √50 = 5√2). The midpoint, slope as a clean fraction, angle of inclination, and quadrant of the direction vector appear alongside.

Inspect the line equation

The line through the two points is rendered in slope-intercept, point-slope, and standard form. The x-intercept, y-intercept, and compass bearing of the segment are surfaced as separate stat tiles.

Step through the math

An expandable step-by-step panel mirrors the working you would write on paper, from the substitution into the formula through the simplification of the radical and the final answer.

Formulas inside the 2D tool

2D distance

d = √[(x₂ − x₁)² + (y₂ − y₁)²]

Straight-line gap, derived from Pythagoras' theorem.

Slope

m = (y₂ − y₁) / (x₂ − x₁)

Rise over run; undefined when x₁ = x₂ (vertical line).

Angle of inclination

θ = arctan(m)

Counter-clockwise angle from the +x axis.

Midpoint

M = ((x₁ + x₂)/2, (y₁ + y₂)/2)

Average the x's and the y's independently.

Slope-intercept form

y = mx + b

Standard high-school form, b is the y-intercept.

Point-slope form

y − y₁ = m(x − x₁)

Convenient when one point and the slope are known.

Standard form

Ax + By + C = 0

Integer-coefficient version preferred in algebra texts.

Where 2D distance is used

Geometry homework

Coordinate-geometry units across pre-algebra, algebra 1, geometry, and pre-calculus rely on the distance formula plus its companions for slope, midpoint, and line equations — exactly what this tab returns in one click.

Game development

Distance checks between players, enemies, projectiles, and items are the most-called function in any 2D game engine. The same √(Δx² + Δy²) drives collision detection, AI awareness radii, and damage falloff.

CAD sketches and drafting

Every dimension constraint on a 2D drafting plane — the distance between two corners, the offset between two slots, the gap between a hole and an edge — is the value this formula returns.

Data plotting

Scatter-plot distance between observations, click-target hit-testing on a chart, and tooltip nearest-neighbour lookups all use 2D Euclidean distance under the hood.

Why a calculator instead of paper?

The 2D distance formula is short, but the surrounding quantities — slope as a clean fraction, angle of inclination in degrees, midpoint in fully-reduced form, and the line equation in three written-out forms — add up to seven separate small calculations from two coordinates. Doing them all by hand is mechanical and error-prone, especially when the numbers are messy or negative. This calculator runs the entire bundle at once so the answer arrives with full context and full working.

Frequently Asked Questions

Subtract the x-coordinates to get Δx and the y-coordinates to get Δy, square both differences, add them, and take the square root. That is the 2-D distance formula d = √[(x₂ − x₁)² + (y₂ − y₁)²], which is just the Pythagorean theorem applied to the right triangle whose legs are Δx and Δy.

The 2-D distance formula is d = √[(x₂ − x₁)² + (y₂ − y₁)²]. In three dimensions it becomes d = √[(x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²]. Both are direct generalisations of Pythagoras' theorem from a single right triangle to higher dimensions.

The horizontal gap Δx and vertical gap Δy between the two points form the two legs of a right triangle whose hypotenuse is the distance you want. Pythagoras says hyp² = Δx² + Δy², so distance = √(Δx² + Δy²). The 3-D version layers another right triangle for the z-gap on top.

Average the x-coordinates and average the y-coordinates: M = ((x₁ + x₂)/2, (y₁ + y₂)/2). The midpoint always lies on the line segment connecting the two original points and is exactly halfway from each. In 3-D, you also average the z-coordinates.

Slope m = (y₂ − y₁) / (x₂ − x₁), often described as 'rise over run'. A positive slope means the line rises left-to-right; a negative slope means it falls; zero means horizontal; vertical lines have undefined slope because Δx = 0.

It is the angle the line makes with the positive x-axis, measured counter-clockwise. You get it directly from the slope: θ = arctan(m). A slope of 1 means a 45° angle; a slope of √3 means a 60° angle; a slope of 0 means a horizontal line.

Compute the slope m = (y₂ − y₁)/(x₂ − x₁), then plug it into point-slope form y − y₁ = m(x − x₁) using either point. Distribute and simplify to get slope-intercept form y = mx + b, or rearrange to standard form Ax + By + C = 0.

Distance is the length of the path travelled and is always non-negative — a scalar. Displacement is the straight-line vector from start to end and has both magnitude and direction. The distance formula returns the magnitude of the displacement vector.

No. Distance is the square root of a sum of squares, so it is always ≥ 0. If you got a negative number, something has gone wrong — most likely a missing parenthesis around (x₂ − x₁)² in your arithmetic.

It shows up in navigation (GPS), engineering (CAD distances), computer graphics (collision detection), machine learning (nearest-neighbour algorithms use Euclidean distance), physics (displacement of an object), surveying, and architecture. Most computer games measure distances between game objects using the very same formula.