Convert simple and compound units by multiplying by conversion factors and cancelling units.
Why this matters
A number without a unit is only half an answer. "The pipe is 3" could mean 3 metres or 3 inches, and that difference has cost real projects money. In 1999 NASA lost the Mars Climate Orbiter partly because one team's software produced thrust data in pound-force seconds while another expected newton seconds. Dimensional analysis is the habit that prevents that kind of error: you carry units through every step and let them tell you whether the setup is right.
The core idea: multiply by one
A conversion factor is a fraction whose top and bottom are equal amounts in different units, such as 1000 m / 1 km. Because the top equals the bottom, the fraction equals 1, and multiplying by 1 never changes a quantity. It only changes the units it is written in.
Write the factor so the unit you want to get rid of appears on the opposite side, then cancel it like a common factor.
Worked example 1: one step
Convert 5 km to metres.
5 km × (1000 m / 1 km) = 5000 m
The "km" on top and the "km" on the bottom cancel, leaving metres.
Worked example 2: a compound unit
Convert 90 km/h to metres per second.
90 km 1000 m 1 h
------ × -------- × -------- = 25 m/s
1 h 1 km 3600 s
- km cancels with km, and h cancels with h.
- The numbers: 90 × 1000 ÷ 3600 = 25.
- The units left are m/s, which is what we wanted. If the units had come out as h·m/s², you would know the setup was wrong before you even looked at the number.
Worked example 3: squared units
A room is 12 m². How many square feet is that? (1 m = 3.2808 ft)
Area units are squared, so the factor must be squared too:
12 m² × (3.2808 ft / 1 m)² = 12 × 10.764 ft² ≈ 129.2 ft²
Using the factor only once would give 39.4, an answer that is wrong by a factor of 3.28. The same rule applies to volume: cube the factor.
Worked example 4: a data rate
How many gigabytes does a 25 Mbit/s video stream use in one hour? (8 bits = 1 byte, 1000 MB = 1 GB)
25 Mbit/s × 3600 s/h × (1 byte / 8 bits) × (1 GB / 1000 MB) = 11.25 GB per hour
Notice the bits-to-bytes step. Network speeds are usually in bits; file sizes are usually in bytes.
Doing it in code
A program can apply a chain of factors the same way: start with the value and multiply by each top/bottom pair in turn.
value = 90 # km/h
for top, bottom in [(1000, 1), (1, 3600)]: # m/km, h/s
value = value * top / bottom
print(value) # 25.0 (m/s)
Useful exact factors
- 1 inch = 2.54 cm (exact, by definition)
- 1 mile = 1.609344 km (exact)
- 1 hour = 3600 s; 1 day = 86,400 s
- 1 litre = 1000 cm³ = 0.001 m³
- 1 kWh = 3.6 × 10^6 J
Common mistakes
- Flipping the factor. If the unit you want to cancel is on top, the factor needs it on the bottom. Write units on every number and the mistake becomes visible.
- Forgetting to square or cube for area and volume.
- Mixing bits and bytes, or decimal (1000) and binary (1024) prefixes. Say which one you used.
- Dropping units halfway through a calculation. Keep them until the very end.
Quick recap
- A conversion factor equals 1, so multiplying by it changes units, not quantity.
- Arrange factors so unwanted units cancel; the units left over check your setup.
- Square factors for area, cube them for volume.
Try it
In the Do tab, finish a small converter that applies a chain of conversion factors, then use it for km/h to m/s and mph to m/s.