Skip to main content

Distance Calculator

Use this Distance Calculator to find distance in several smart ways: between two points, in 3D, from a point to a line, with speed, time, and distance, using latitude and longitude, or on a simple scaled coordinate grid. It is built to be educational, user friendly, and helpful for both math problems and real-world distance questions.

Background

In math, distance measures how far apart two objects are. In coordinate geometry, distance often comes from the Pythagorean theorem. In real-world travel and navigation, distance may be measured on a flat grid, along a route, or across the Earth using great-circle distance. This calculator brings these ideas together in one flexible tool.

Enter values

Math Distance

Travel Distance

Use the Distance Between Two Points Calculator for standard coordinate geometry problems on the x-y plane.

Distance Between Two Points

3D Distance Between Two Points

Point-to-Line Distance

Enter the line in standard form: Ax + By + C = 0.

Speed, Time, and Distance

Latitude and Longitude Distance

Valid range: -90 to 90

Valid range: -180 to 180

About this mode

This mode uses the Haversine formula to estimate the shortest distance along the Earth’s surface, often called the great-circle distance.

Scaled Grid Distance

Each grid unit represents this real-world distance. Useful for plans, diagrams, blueprints, and scaled drawings.

Options

Rounding affects display only.

Chips prefill and calculate immediately.

Result

No results yet. Enter values and click Calculate.

How to use this calculator

  • Choose the distance mode that matches your problem.
  • Enter the required values, such as coordinates, line coefficients, or speed and time values.
  • Click Calculate to see the answer, supporting values, a visual, and optional step-by-step work.

How this calculator works

  • For two points in 2D, it uses d = √((x₂ − x₁)² + (y₂ − y₁)²).
  • For 3D points, it uses d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²).
  • For a point to a line, it uses d = |Ax₀ + By₀ + C| / √(A² + B²).
  • For speed, time, and distance, it uses d = rt, r = d/t, or t = d/r.
  • For latitude and longitude, it uses the Haversine formula to estimate great-circle distance on Earth.
  • For scaled grid mode, it first finds straight-line grid distance, then applies your chosen scale.

Formulas & Equations Used

2D distance: d = √((x₂ − x₁)² + (y₂ − y₁)²)

3D distance: d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²)

Point to line: d = |Ax₀ + By₀ + C| / √(A² + B²)

Distance / speed / time: d = rt

Haversine: a = sin²(Δφ/2) + cos(φ₁)cos(φ₂)sin²(Δλ/2)

Great-circle distance: d = 2R · asin(√a)

Example Problems & Step-by-Step Solutions

Example 1 — Distance between two points

Find the distance between (1, 2) and (4, 6).

  1. Find the horizontal change: 4 − 1 = 3.
  2. Find the vertical change: 6 − 2 = 4.
  3. Use the distance formula: d = √(3² + 4²) = √25 = 5.

Example 2 — Point to line distance

Find the distance from (3, 4) to the line 2x − y − 5 = 0.

  1. Substitute the point into the numerator: |2(3) + (-1)(4) + (-5)| = |6 - 4 - 5| = 3.
  2. Find the denominator: √(2² + (-1)²) = √5.
  3. Distance is 3 / √5.

Example 3 — Latitude and longitude distance

Enter two coordinate pairs and the calculator estimates the shortest path along Earth’s surface in kilometers, miles, and nautical miles.

Frequently Asked Questions

Q: What is the distance formula?

The standard 2D distance formula is d = √((x₂ − x₁)² + (y₂ − y₁)²).

Q: Can distance be negative?

No. Distance is a length, so it is always zero or positive.

Q: What is the difference between straight-line distance and scaled grid distance?

Straight-line distance is the shortest path between two points. Scaled grid distance uses that straight-line result and applies a chosen scale. It is not the same as route or driving distance.

Q: What does latitude and longitude distance measure?

It estimates the shortest distance over the Earth’s surface between two geographic coordinates.