$devtoolkit.sh/examples/math/unit-conversion

Common Unit Conversion Examples

Unit conversion mistakes can cause real problems in applications that handle measurements from users in different regions or from multiple APIs using different unit systems. This reference shows conversion formulas and common values for temperature (Celsius to Fahrenheit), length (meters to feet), weight (kilograms to pounds), and data sizes (bytes to kilobytes to megabytes). The temperature converter handles the offset formula that trips up many developers who forget that the conversion is not a simple multiplication.

Example
# Temperature
0°C  = 32°F    (freezing)
20°C = 68°F    (room temperature)
37°C = 98.6°F  (body temperature)
100°C = 212°F  (boiling)
-40°C = -40°F  (same in both scales)

# Formula: °F = (°C × 9/5) + 32
# Formula: °C = (°F - 32) × 5/9

# Length (quick reference)
1 meter = 3.281 feet = 39.37 inches
1 kilometer = 0.621 miles
1 inch = 2.54 centimeters

# Weight
1 kilogram = 2.205 pounds
1 pound = 453.6 grams
[ open in Temperature Converter → ]

FAQ

Why is the temperature conversion formula non-linear?
The Celsius and Fahrenheit scales have different zero points (0°C = 32°F) and different step sizes (one Celsius degree = 1.8 Fahrenheit degrees). The +32 offset accounts for the different zero points.
What is the only temperature where Celsius and Fahrenheit are equal?
At -40 degrees, both scales give the same reading. This is a useful sanity check: if your conversion formula gives different values at -40, there is an error in the formula.
How do I convert Celsius to Kelvin?
Add 273.15 to the Celsius value. Kelvin starts at absolute zero (-273.15°C) and uses the same step size as Celsius, so the conversion is a simple addition with no scaling factor.

Related Examples

/examples/math/unit-conversionv1.0.0