Unit Converter

Convert between different units of measurement - length, weight, temperature, and more.

About Unit Conversion

Unit conversion translates a measurement from one system or scale to another equivalent value. The two dominant measurement systems are the International System of Units (SI / metric), used by most of the world, and the Imperial/US Customary system, used primarily in the United States. Scientific and technical work universally uses SI units.

Accurate unit conversion is critical in engineering, science, medicine, and international commerce. Unit errors have caused serious real-world failures: NASA's Mars Climate Orbiter was lost in 1999 because one team used metric units and another used imperial, causing a navigation error that destroyed the spacecraft — a $327 million lesson.

Key Conversion Reference

  • Length: 1 inch = 2.54 cm; 1 foot = 0.3048 m; 1 mile = 1.60934 km
  • Weight: 1 pound = 0.453592 kg; 1 kilogram = 2.20462 lbs; 1 ounce = 28.3495 g
  • Temperature: °F = (°C × 9/5) + 32; °C = (°F − 32) × 5/9; K = °C + 273.15
  • Volume: 1 US gallon = 3.78541 L; 1 liter = 0.264172 US gallons
  • Speed: 1 mph = 1.60934 km/h; 1 m/s = 3.6 km/h; 1 knot = 1.852 km/h
  • Data: 1 KiB = 1,024 bytes; 1 KB = 1,000 bytes; 1 GiB = 2³⁰ bytes

The Metric vs Imperial Divide

The metric system is based on powers of 10, making conversions trivial: 1 kilometer = 1,000 meters = 100,000 centimeters. Imperial units have no such regularity: 1 mile = 1,760 yards = 5,280 feet = 63,360 inches. This makes mental math dramatically harder with Imperial units and is the main reason the scientific community universally uses SI. The US, Liberia, and Myanmar are the only countries that have not fully adopted metric officially.

Frequently Asked Questions

What is the difference between weight and mass?

Mass is the amount of matter in an object (kilograms, grams). Weight is the force of gravity acting on that mass (Newtons). In everyday usage, "weight" and "mass" are used interchangeably because we all live at roughly the same gravitational field strength. On the Moon, your mass stays the same but your weight is about 1/6 of your Earth weight.

Why are there two definitions of kilobyte?

Historically, the computer industry used 1 KB = 1,024 bytes (2¹⁰) because computers work in powers of 2. In 1998, the IEC introduced new prefixes: kibibyte (KiB) = 1,024 bytes, kilobyte (KB) = 1,000 bytes. Operating systems still typically report storage in binary (Windows shows "KB" meaning 1,024 bytes), while storage manufacturers use SI (1 GB = 10⁹ bytes), making drives appear slightly larger than their binary capacity.

How do I handle unit conversion in Java?

For basic needs, implement conversion constants as static finals. For serious engineering applications, use the Units of Measurement API (JSR 385) with the indriya reference implementation. This provides type-safe quantities: Quantity<Length> d = Quantities.getQuantity(5, KILOMETRE), with automatic conversion and dimensional analysis that prevents unit errors at compile time.