MATH CALCULATOR

Distance Calculator

Calculate the non-negative distance between two numeric positions on a number line.

Distance formula

For two positions on a straight number line, distance is the absolute difference: d = |x₂ − x₁|. The result is non-negative, so the order of the two positions does not change the distance.

What this calculator measures

This page calculates one-dimensional distance from two numeric positions. For a full 2D coordinate calculation, use the Distance Between Points Calculator.

Browse all Calcora calculators

Worked examples on a number line

If one position is 12 and another is 4, the distance is |12 − 4| = 8 units. Reversing the order gives |4 − 12| = 8 units as well, because distance measures separation rather than direction. If the positions are −3 and 5, the distance is |−3 − 5| = 8 units. These examples assume both values use the same scale and unit.

Distance is not the same as displacement

Distance is non-negative and describes how far apart two positions are. Displacement keeps direction and is often calculated as final position minus initial position. For example, moving from position 4 to position 12 gives a displacement of +8, while moving from 12 to 4 gives −8; the distance between the positions is 8 in either case.

When another calculator is needed

This page accepts two scalar positions and returns their one-dimensional separation. It does not calculate road distance, travel time, or the Euclidean distance between two coordinate pairs. For points (x₁, y₁) and (x₂, y₂), use the distance-between-points calculator, which applies the two-dimensional formula √[(x₂ − x₁)² + (y₂ − y₁)²]. For motion problems involving speed and time, use a tool designed for those inputs and make sure the units are compatible.

Calculation context

Distance calculations connect speed and time or other supplied motion quantities depending on the selected model. Units must be compatible with the formula used.

Science & Physics Calculators · All Calculators

Worked number-line example

If one position is −3 and the other is 8, the distance is |8 − (−3)| = |11| = 11 units. Subtracting a negative number adds its magnitude, which is a common source of mistakes. Reversing the two positions gives the same distance because absolute value is always non-negative.

Distance versus displacement

Distance describes the separation between two positions. Displacement describes the signed change from a starting position to an ending position. For example, moving from position 8 to position −3 has a displacement of −11 units but a distance of 11 units. This calculator returns distance only.

Keep the scale consistent

Both values must use the same unit and refer to the same number line. If positions are measured in metres, the answer is metres; if they are measured in kilometres, the answer is kilometres. For two-dimensional coordinates, use the Distance Between Two Points Calculator instead.

When this formula is not enough

The absolute-difference formula does not calculate a route distance, travel time, or distance on Earth's curved surface. Those questions require additional information, such as a route, speed, geographic coordinates or an appropriate map-distance model.

Distance formula and worked examples

For two positions on a number line, distance is the absolute difference: d = |x₂ − x₁|. Absolute value removes the direction sign, so the result is never negative. Both positions must use the same unit and reference scale.

Worked examples

From −3 to 5, d = |5 − (−3)| = |8| = 8 units. From 12 to 4, d = |4 − 12| = |−8| = 8 units. The order changes the signed displacement, but not the distance between the same two positions.

Distance, displacement and travel path

Distance between two positions is not necessarily the total path travelled. If someone walks 3 m east and then 3 m west, the total distance travelled is 6 m, but the final position is the starting position, so displacement is zero. This calculator finds the separation between two numeric positions; it does not add up a multi-step journey.

When to use a different calculator

For points with both x and y coordinates, use the Euclidean distance formula d = √[(x₂−x₁)² + (y₂−y₁)²]. For three-dimensional coordinates, include the squared z-coordinate difference as well. Keep units consistent across every coordinate.

Distance calculator FAQs

Can distance be negative?

No. Distance is a non-negative separation. A signed value belongs to displacement or a coordinate difference, not distance.

Does this calculator find driving distance?

No. It calculates one-dimensional numeric separation, not road routes, walking paths or geographic distance.

What if the two values are equal?

The distance is zero because both positions are identical on the number line.

Distance Calculator: Formula and Example

Distance depends on the type of problem. For constant speed, the basic relationship is distance = speed × time. This calculator is intended for straightforward distance calculations where the selected units are consistent.

Worked example

If a vehicle travels at 60 km/h for 2.5 hours, the estimated distance is 150 km. If time is entered in minutes, convert it to hours before using a speed expressed in km/h.

Units and conversions

Distance may be expressed in kilometers, miles, meters, feet, or other units. Speed and time must use compatible units. A result from a mathematical distance formula is not automatically a route distance or travel-time prediction.

Frequently Asked Questions

What is the basic distance formula?

For constant speed, distance equals speed multiplied by time.

Does this account for traffic or stops?

No. The basic formula assumes the stated speed applies throughout the time period. Real travel can include stops, changing speed, and route differences.

Check the meaning of a distance estimate

The equation distance = speed × time gives distance travelled when the stated speed represents the whole time interval. If a vehicle averages 60 km/h for 1.5 hours, the estimated distance is 90 km. This is not necessarily the road distance between two addresses.

Stops and changing speed

If the 1.5-hour period includes a 15-minute stop, the moving time is 1.25 hours. At an average moving speed of 60 km/h, the distance would be 75 km. Use the same definition of time and speed to avoid mixing moving speed with trip-average speed.

For real routes

Road curves, detours, traffic and route choice require map or GPS data. Treat a constant-speed result as a mathematical estimate, not a navigation instruction or a guaranteed arrival distance.