Distance Calculator
Use this Distance Calculator to calculate distance between two points in 2D, distance between two points in 3D, distance from speed and time, time from distance and speed, speed from distance and time, route distance units, and coordinate-based measurement conversions. It supports common metric, imperial, and scientific distance units.
Calculate Distance
Select a mode, enter the known values, and calculate distance, speed, time, coordinate length, midpoint, slope, and unit conversions.
What Is a Distance Calculator?
A Distance Calculator is a math and measurement tool that helps find the distance between two points, the distance traveled from speed and time, the speed needed to cover a distance, the time required to travel a distance, or the equivalent value of a distance in another unit. Distance is one of the most common quantities in mathematics, physics, geometry, travel planning, navigation, sports, engineering, construction, mapping, and everyday life.
In geometry, distance often means the length of the straight line between two coordinate points. If you know two points such as \((x_1,y_1)\) and \((x_2,y_2)\), the calculator uses the Pythagorean theorem to find the length of the line segment connecting them. In three-dimensional geometry, the same idea extends to points such as \((x_1,y_1,z_1)\) and \((x_2,y_2,z_2)\).
In motion problems, distance is usually connected to speed and time. If a car travels at 60 miles per hour for 2.5 hours, the distance is 150 miles. If a train covers 300 kilometers in 4 hours, the average speed is 75 kilometers per hour. If a runner covers 10 kilometers at 12 km/h, the time is \(10/12\) hours. These relationships appear in school math, physics, driving estimates, fitness planning, aviation, shipping, and logistics.
This calculator combines several common distance tools into one WordPress-ready section. It includes a 2D distance calculator, 3D distance calculator, speed-time-distance calculator, speed or time solver, and unit converter. It also explains the formulas so the page works as both a practical calculator and an educational guide.
How to choose the right distance-calculator mode
Direct answer: use 2D Points or 3D Points when you know coordinates, Speed × Time when you know a rate and a duration, Solve Speed / Time when one of those quantities is unknown, and Unit Converter when you already know a distance but need another unit. The result is only as meaningful as the model and units you enter, so choose the mode that matches the problem before pressing Calculate.
This page is a general mathematics tool. Coordinate distance is a straight-line measurement in a coordinate system. It is not automatically the distance travelled along a road, a walking route, a flight path, or a curved surface. The speed-and-time modes calculate a distance from a supplied rate and duration; they do not obtain a route from a map or estimate traffic.
Quick mode guide
| Mode | Use it when you know | Main relationship |
|---|---|---|
| 2D Points | (x₁, y₁) and (x₂, y₂) | d = √((x₂ − x₁)² + (y₂ − y₁)²) |
| 3D Points | (x₁, y₁, z₁) and (x₂, y₂, z₂) | d = √(Δx² + Δy² + Δz²) |
| Speed × Time | speed and elapsed time | d = speed × time |
| Solve Speed / Time | two of distance, speed, and time | d = r × t, rearranged |
| Unit Converter | a value and its starting unit | convert the same length to a selected unit |
Coordinates can be positive, zero, or negative. A negative coordinate does not mean a negative distance; it places a point on the opposite side of an axis. Distance itself is a non-negative magnitude, so the calculator reports the size of the separation.
2D distance between two coordinate points
For points in a flat coordinate plane, subtract the x-coordinates and y-coordinates separately. These differences are the horizontal and vertical legs of a right triangle. The straight-line distance is the hypotenuse, so the Pythagorean theorem gives d = √(Δx² + Δy²).
Worked example: for A = (0, 0) and B = (3, 4), Δx = 3 and Δy = 4. The calculation is √(3² + 4²) = √25 = 5. The points are 5 coordinate units apart. If the coordinates represent meters, the result is 5 meters; if they represent kilometers, it is 5 kilometers. The numbers alone do not determine the physical unit.
For A = (−2, 5) and B = (4, −3), Δx = 4 − (−2) = 6 and Δy = −3 − 5 = −8. Squaring removes the sign during the distance calculation: √(6² + (−8)²) = √100 = 10. The negative coordinate values matter when finding the differences, but the final distance is positive.
Midpoint and slope as companion information
When the 2D mode reports a midpoint, it is using the average of the corresponding coordinates: M = ((x₁ + x₂)/2, (y₁ + y₂)/2). The midpoint is the location halfway along the straight segment joining the two points. It is not the halfway point of a road route unless the coordinate model itself represents that route.
The slope, when defined, is m = (y₂ − y₁)/(x₂ − x₁). A vertical line has an undefined slope because the denominator is zero. A slope describes direction and steepness; it is not another name for distance. Use the distance result for separation and the slope result for the line’s change in y relative to x.
3D distance between two points
For three-dimensional coordinates, the calculator adds the squared changes along the x-, y-, and z-axes: d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²). This is the 3D version of the same right-triangle idea. It is useful for geometry, vectors, computer graphics, robotics exercises, and any model in which all three axes use a consistent scale.
Worked example: from P = (0, 0, 0) to Q = (1, 2, 2), the squared changes are 1, 4, and 4. Therefore d = √(1 + 4 + 4) = √9 = 3 units. For points (2, −1, 4) and (5, 3, 0), the changes are 3, 4, and −4, so the distance is √(9 + 16 + 16) = √41, approximately 6.403 units when displayed to three decimal places.
Do not mix a height measured in meters with horizontal coordinates measured in feet unless you intentionally convert them first. A formula can still produce a number when the axes use incompatible scales, but that number does not represent a valid physical distance until the units are made consistent.
Distance from speed and time
The relationship d = r × t works when the speed or rate is constant over the time interval, or when the supplied rate is an appropriate average for the calculation. Units must cancel correctly. For example, 60 miles per hour multiplied by 2 hours gives 120 miles. The page converts the selected input units before presenting the requested output unit.
Worked example: at 55 kilometers per hour for 2.5 hours, d = 55 × 2.5 = 137.5 kilometers. If the time is given in minutes, convert it to hours before multiplying by a rate in kilometers per hour: 30 minutes is 0.5 hour, not 30 hours.
This model assumes the rate and time refer to the same interval. If a journey includes stops, changing speeds, or several legs, calculate each leg separately and add the distances when that is appropriate. A single average-speed calculation may be useful for a summary, but it cannot show where the changes occurred.
Solving for speed or time
Rearranging d = r × t gives r = d/t when time is known and non-zero, or t = d/r when speed is known and non-zero. The Solve Speed / Time mode lets you identify the unknown and enter the two quantities you have. Keep the units aligned: distance in miles divided by hours produces miles per hour; distance in meters divided by seconds produces meters per second.
Example for speed: if a 150-kilometer distance takes 3 hours, the average speed is 150 ÷ 3 = 50 kilometers per hour. Example for time: at 12 meters per second, covering 240 meters takes 240 ÷ 12 = 20 seconds. These are average relationships; they do not imply that the object travelled at that speed at every instant.
A zero time cannot be used as a divisor, and a zero speed cannot produce a positive travel distance in the model. If the inputs describe a stationary object, the result should be interpreted as zero distance for the interval rather than forcing a non-zero answer.
Distance units, conversion, and rounding
Choose the unit that matches the input and the unit that makes the output useful. Common metric relationships include 1 kilometer = 1,000 meters and 1 meter = 100 centimeters. Imperial and nautical units use their own defined relationships. The unit converter changes the numerical representation of the same length; it does not change the underlying measurement or make an approximate input more precise.
Round at the end of the calculation whenever possible. If you round the coordinate differences before squaring them, or round each journey leg before adding the legs, the final result can drift. The calculator’s decimal selector controls the displayed precision, not the precision of the original measurement.
For a formal report, record the input values, units, formula or mode, and chosen decimal places. A result such as 2.50 km communicates a different reporting convention from 2.5 km even though the numerical length is the same. Do not add trailing digits merely to make a result look more accurate than the source data.
Straight-line distance is not route distance
Coordinate distance measures the direct segment between two points in the chosen coordinate space. A road journey generally follows a network of streets, turns, restrictions, and paths, so its route distance can be longer. A map distance may also use geographic coordinates and a surface model rather than a flat Cartesian plane. This calculator does not replace a map-routing service or a surveying workflow.
The distinction matters in practical questions. If a problem asks how far apart two plotted points are, use the coordinate formula. If it asks how far a driver travels along roads, use route data. If it asks for the shortest path across a room, a straight-line measurement may be appropriate, but obstacles and permitted paths may change the practical answer.
Common mistakes to check before trusting a result
- Swapping the task: use 2D or 3D coordinates for point separation, not Speed × Time.
- Mixing units: make sure all coordinate axes and rate/time inputs use compatible units.
- Subtracting signs incorrectly: remember that 4 − (−2) is 6.
- Using minutes as hours: convert the time unit or select the matching time option.
- Confusing distance and displacement: a signed direction or vector is not the same as a non-negative distance.
- Rounding too early: keep extra digits until the final display step.
- Calling a route result a coordinate result: straight-line and road distances answer different questions.
- Entering a zero divisor: speed cannot be solved by dividing by zero time, and time cannot be solved by dividing by zero speed.
How to show the calculation in schoolwork
Write the formula first, substitute values with their units, simplify, and state the result with a sensible level of precision. For a 2D example, show Δx = 3, Δy = 4, then d = √(3² + 4²) = 5 units. For speed and time, show d = 55 km/h × 2.5 h = 137.5 km; the hour unit cancels.
If you use the calculator as a check, compare your intermediate values as well as the final result. A matching final number with a different setup may hide a unit mismatch that happens to cancel. Explaining the setup makes the solution easier for another student or teacher to review.
Practical distance-calculator questions
What is the shortest distance between two points?
In a flat Euclidean coordinate plane, the shortest path between two points is the straight line segment connecting them. The 2D formula calculates the length of that segment.
Can coordinates be negative?
Yes. Negative coordinates identify positions relative to an axis. The distance formula squares the coordinate differences, so the reported separation remains non-negative.
What does a coordinate unit mean?
A coordinate unit is whatever unit the model assigns to its axes. The calculator can display a selected unit, but the meaning depends on your input data and whether the axes use a consistent scale.
Why is my road distance longer?
Road distance follows a route with turns and restrictions. Coordinate distance is usually a direct straight-line measurement, so the two values answer different questions.
Can I use this for latitude and longitude?
Only with care. Latitude and longitude describe positions on a curved Earth, while the coordinate modes use ordinary Cartesian formulas. For geographic distances, use a geospatial method suited to the region, coordinate system, and required accuracy.
What happens when the speed changes?
Split the journey into intervals with their own speeds and times, calculate each distance, and add the distances if the path is continuous. A single speed-time multiplication is appropriate only for a constant or intentionally averaged rate.
Why does the calculator round the result?
Rounding keeps the displayed answer readable. Choose a precision appropriate to the input data and task, and retain more digits in intermediate work when needed.
Can distance be negative?
Ordinary distance is a non-negative magnitude. A negative sign can belong to a coordinate, direction, or signed displacement, but it is not normally a negative separation.
What is the difference between distance and displacement?
Distance describes how much path was covered or the size of a separation. Displacement is a directed change from an initial position to a final position. A return trip can have positive distance but zero net displacement.
How can I verify a result?
Check the selected mode, write the formula, confirm the units, and estimate the expected scale. For 2D coordinates, compare with the larger horizontal and vertical changes; for speed and time, check that the answer grows when either positive input grows.
Use the result responsibly
This tool is suitable for homework checks, geometry practice, coordinate exercises, unit conversions, and transparent everyday calculations. It cannot verify the quality of a measuring instrument, determine a road route, replace a survey, or decide which coordinate system a professional project requires. Keep the original measurement and unit labels with any result that will be reused.
For a related learning path, explore the site’s geometry worksheets for practice or browse the math calculator collection for other tools. The best next step depends on whether you need more practice, a different formula, or another unit.
How to Use the Distance Calculator
Choose the tab that matches the type of problem you want to solve. Use the 2D Points tab when you have two points on a plane, such as coordinates on a graph, map grid, drawing, or geometry diagram. Enter \(x_1\), \(y_1\), \(x_2\), and \(y_2\). The calculator returns distance, midpoint, slope, horizontal change, and vertical change.
Use the 3D Points tab when the points include depth or height. Enter \(x_1\), \(y_1\), \(z_1\), \(x_2\), \(y_2\), and \(z_2\). This is useful for vectors, 3D geometry, coordinate modeling, engineering drawings, graphics, and physical space problems.
Use the Speed × Time tab when you know speed and travel time and want the distance. Choose a speed unit such as miles per hour, kilometers per hour, meters per second, feet per second, or knots. Then enter time in seconds, minutes, hours, or days. The calculator converts values internally and returns the distance in your selected output unit.
Use the Solve Speed / Time tab when you know distance and either speed or time. If you solve for speed, enter distance and time. If you solve for time, enter distance and speed. Use the Unit Converter tab when you simply want to convert kilometers to miles, miles to kilometers, meters to feet, inches to centimeters, or another distance conversion.
Distance Calculator Formulas
The 2D coordinate distance formula comes from the Pythagorean theorem:
The 3D distance formula adds a third squared difference:
The speed, time, and distance relationship is:
Here, \(d\) is distance, \(r\) is speed or rate, and \(t\) is time. The same relationship can be rearranged to solve for speed or time:
For a line segment in 2D, the midpoint is:
The slope of the line through two points is:
For unit conversion, the calculator converts each value into meters first, then converts meters into the target unit:
2D and 3D Coordinate Distance Explained
Coordinate distance measures the straight-line length between points. In 2D, the two points lie on a flat coordinate plane. The horizontal difference is \(x_2-x_1\), and the vertical difference is \(y_2-y_1\). These two differences form the legs of a right triangle. The distance between the points is the hypotenuse, so the Pythagorean theorem gives the distance formula.
For example, the distance between \((1,2)\) and \((7,10)\) uses a horizontal change of \(6\) and a vertical change of \(8\). The distance is \(\sqrt{6^2+8^2}=\sqrt{100}=10\). This is a classic 6-8-10 right triangle.
In 3D, the same idea applies, but there is also a depth or height difference. A 3D point has \(x\), \(y\), and \(z\) coordinates. The distance formula squares the difference in each coordinate, adds the squared values, and takes the square root. This is useful in vector geometry, physical modeling, game development, robotics, architecture, and engineering.
Coordinate distance is not always the same as travel distance. If two cities are 100 miles apart in a straight line, the road distance may be longer because roads curve, avoid obstacles, follow terrain, and connect through networks. Coordinate distance is best for geometry and direct-line measurement, while route distance needs map or road-network data.
Speed, Time, and Distance
The formula \(d=rt\) is one of the most important measurement relationships. If speed is constant, distance equals speed multiplied by time. This relationship is common in travel, transportation, running, cycling, shipping, aviation, physics, and school word problems.
The formula only works directly when units match. If speed is in miles per hour, time should be in hours to produce miles. If speed is in meters per second, time should be in seconds to produce meters. This calculator handles the conversions automatically by converting speed into meters per second and time into seconds internally.
Average speed is different from instantaneous speed. If you drive 150 miles in 3 hours, your average speed is 50 mph. That does not mean the car traveled at exactly 50 mph every moment. It may have slowed down, stopped, or sped up. The calculator uses average speed for travel-style calculations.
Distance Unit Conversion
Distance can be measured in millimeters, centimeters, meters, kilometers, inches, feet, yards, miles, and nautical miles. Metric units are based on powers of ten, making them easy to scale. Imperial and US customary units use fixed conversion factors, such as 12 inches per foot and 5280 feet per mile. Nautical miles are commonly used in marine and aviation contexts.
| Unit | Symbol | Meters | Common Use |
|---|---|---|---|
| Millimeter | mm | 0.001 | Small objects, engineering, technical drawings |
| Centimeter | cm | 0.01 | Body measurements, classroom geometry, small distances |
| Meter | m | 1 | Standard SI distance unit |
| Kilometer | km | 1000 | Travel, maps, road distances in metric countries |
| Inch | in | 0.0254 | Small imperial measurements |
| Foot | ft | 0.3048 | Height, construction, aviation altitude |
| Yard | yd | 0.9144 | Sports fields, fabric, land measurement |
| Mile | mi | 1609.344 | Road distance in the United States and UK contexts |
| Nautical mile | nmi | 1852 | Marine navigation and aviation |
When converting distance units, it is safest to use a base unit. This calculator uses meters as the internal base. For example, 10 kilometers becomes 10,000 meters. To convert meters to miles, the calculator divides by 1609.344.
Straight-Line Distance vs Route Distance
A straight-line distance is the shortest direct path between two points in a flat coordinate system. In geometry, this is the line segment connecting the points. In real-world travel, a straight-line distance may be called “as-the-crow-flies” distance. It is useful for quick comparison, map scale, geometry, and spatial analysis.
A route distance is the actual distance traveled along roads, paths, railways, walking routes, flight paths, or shipping lanes. Route distance is often longer than straight-line distance because movement must follow available paths and avoid obstacles. A driving route can be much longer than a straight-line distance if roads curve around mountains, rivers, buildings, or restricted areas.
This calculator does not fetch live map routes. It calculates mathematical distance from coordinates and motion formulas. For real driving, walking, transit, or flight routes, use a map service to get route-specific distance and travel time.
Distance Calculation Examples
Example 1: Find the distance between \((1,2)\) and \((7,10)\).
Example 2: Find the distance between \((1,2,3)\) and \((6,8,12)\).
Example 3: A car travels at 60 miles per hour for 2.5 hours. The distance is:
Example 4: A train travels 300 kilometers in 4 hours. The average speed is:
Example 5: Convert 10 kilometers to miles.
Common Distance Calculation Mistakes
The first common mistake is mixing units. If speed is in kilometers per hour and time is in minutes, you cannot multiply the values directly without converting minutes to hours. The second mistake is confusing straight-line distance with route distance. A coordinate formula gives the direct line, not the actual road path.
Another mistake is forgetting the square root in the coordinate distance formula. Squaring the coordinate differences and adding them gives the squared distance. You must take the square root to get the actual distance. In 2D, some users also confuse distance with slope. Slope describes steepness; distance describes length.
For travel questions, remember that the speed-time-distance formula usually uses average speed. Real travel speed changes during stops, traffic, turns, acceleration, and delays. For planning, add buffer time if the real situation involves uncertainty.
Distance Calculator FAQs
What does a distance calculator do?
It calculates distance between coordinate points, distance from speed and time, speed from distance and time, time from distance and speed, and distance unit conversions.
What is the distance formula between two points?
The 2D distance formula is \(d=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}\).
What is the 3D distance formula?
The 3D distance formula is \(d=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2+(z_2-z_1)^2}\).
How do I calculate distance from speed and time?
Use \(d=rt\), where \(d\) is distance, \(r\) is speed, and \(t\) is time.
How do I calculate speed from distance and time?
Use \(r=d/t\). Divide total distance by total time.
How do I calculate time from distance and speed?
Use \(t=d/r\). Divide distance by speed.
Is coordinate distance the same as driving distance?
No. Coordinate distance is usually straight-line distance. Driving distance follows roads and is often longer.
Important Note
This Distance Calculator is for educational, planning, geometry, physics, and general measurement use. It does not provide live map routing, GPS navigation, official surveying data, aviation route clearance, marine navigation certification, or legal land measurement. For high-stakes navigation, construction, surveying, or engineering work, verify results with approved professional tools.


