← Guides

Unit Conversion Explained: Length, Weight, Temperature & Data

Why unit conversions go wrong

A unit conversion is a single multiplication only when both units measure the same quantity from the same zero point. Length, mass, area, speed and data size behave that way: one kilometre is exactly 1,000 metres, and one pound is exactly 0.45359237 kilograms. Temperature does not. Celsius and Fahrenheit place zero at different physical states, so converting between them needs an offset as well as a factor. Confusing these two families of conversion is the source of most wrong answers, and no number of decimal places will compensate for a missing offset.

The second common failure is choosing the wrong unit name. A gallon, a ton and a kilobyte each mean more than one thing, and the difference is often larger than the rounding error people worry about.

Linear units: metric and imperial

The metric system is decimal, so converting inside it is a matter of moving the decimal point: 1,250 millimetres is 1.25 metres. Imperial and US customary units use historical ratios that are now defined exactly against metric values, so the arithmetic is still a multiplication — only the factor looks less tidy. The table below collects the factors that cover most everyday work.

QuantityMetric referenceImperial or US unitExact factor
Length1 kilometre0.621371 miles1 mile = 1,609.344 m
Length1 metre3.28084 feet1 foot = 0.3048 m
Mass1 kilogram2.204623 pounds1 pound = 0.45359237 kg
Speed1 kilometre per hour0.621371 miles per hour1 mph = 1.609344 km/h
Volume1 litre0.264172 US gallons1 US gallon = 3.785411784 L

Once the factor is exact, precision becomes a display decision. 12 km = 7.456454 mi, but showing six decimals for a driving distance implies precision the measurement never had. Two or three significant digits are usually enough, and the rounding should happen at the very end rather than at every step.

Temperature is an affine transform

Celsius and Kelvin share the same step size — one kelvin equals one degree Celsius — but Kelvin starts at absolute zero, 273.15 below the Celsius zero. Fahrenheit uses a smaller degree: 180 Fahrenheit degrees span the same interval as 100 Celsius degrees, which gives the 9/5 ratio. Two offsets and one ratio are all you need.

°F = °C × 9/5 + 32
°C = (°F − 32) × 5/9
K  = °C + 273.15

For example, 20 °C = 68 °F = 293.15 K, and normal body temperature 37 °C = 98.6 °F. A freezing point of 0 °C = 32 °F = 273.15 K is the sanity check most people remember. The popular shortcut "double it and add 30" is only an estimate: at 20 °C it produces 70 °F, two degrees off, and the error grows as values move away from room temperature.

One consequence deserves its own warning: a temperature difference converts with the ratio alone. A rise of 5 °C is a rise of 9 °F, not 41 °F, because a difference has no zero point to shift. Applying the full offset to a delta is a frequent bug in weather, cooking and engineering code.

Gallons, tonnes and other ambiguous names

A US gallon is 3.785411784 litres; an imperial gallon is 4.54609 litres, about 20% larger. That gap is large enough to ruin a recipe or a fuel calculation. 5 US gal = 18.927 L, while 5 imperial gal = 22.730 L. British recipes written before 1970 and American fuel economy figures use different gallons, so the country of origin matters more than the number of decimals.

"Ton" is worse. A metric tonne is 1,000 kg, a US short ton is 907.18474 kg, and a UK long ton is 1,016.0469088 kg. Shipping, refrigeration and air conditioning add further meanings that are rates rather than masses. When a document says "ton", look for the country or the standard before multiplying anything. The same caution applies to ounces: a fluid ounce measures volume, while an ounce measures mass, and they are not interchangeable.

KB or KiB: decimal and binary data sizes

Storage manufacturers count in powers of ten, while many operating systems and programming interfaces count in powers of two. Both conventions are legitimate, but they use different names and different numbers.

Decimal (SI)Binary (IEC)BytesDifference
1 KB1 KiB1,000 vs 1,0242.4%
1 MB1 MiB1,000,000 vs 1,048,5764.9%
1 GB1 GiB1,000,000,000 vs 1,073,741,8247.4%
1 TB1 TiB1,000,000,000,000 vs 1,099,511,627,77610.0%

The gap grows with every step, which explains why a drive advertised as 500 GB shows roughly 465.66 GiB in an operating system that uses binary units. 1 MiB = 1.048576 MB, and a 16 GB memory module reports about 14.901 GiB. Neither number is wrong; they answer different questions. Write the unit explicitly in interfaces, and store byte counts as integers to avoid fractional precision loss.

Rounding, precision and a short checklist

Binary floating point cannot represent most decimal fractions exactly, so repeated conversion can drift. Convert once from the original value, keep full precision through intermediate steps, and round only for display. Compare floating results with a tolerance such as Math.abs(a - b) < 1e-9 rather than with strict equality.

  • Round once, at the end. Rounding at each step accumulates error, especially in chains of conversions.
  • Identify the gallon, the ton and the ounce. The name alone is not enough to pick a factor.
  • Treat a temperature difference differently from a temperature. Use the ratio, not the offset, for deltas.
  • Say KB or KiB. Mixing decimal and binary prefixes makes storage numbers look broken.
  • Check the direction of the factor. Dividing by 1,609.344 converts metres to miles; multiplying does the opposite.

Convert length, mass, temperature, area, speed and data sizes in one page with our unit converter: choose a category, type a value and read the result and reference table instantly. For number bases rather than physical units, see binary, hex and decimal conversion; for the size side of data, read lossy vs lossless image compression.

Try it yourself: open the Unit Converter →