Skip to main content
CodeLint.Dev Dev Tools

Unit Converter — Length, Mass, Temperature, Volume & Data

Convert across measurement systems with full precision throughout. No rounding at intermediate steps, which is where accumulated conversion error usually comes from.

Unit Converter

Convert between units of length, weight, temperature, area, volume, speed, data, pressure, and energy.

Category
Convert
All Conversions
mm 1
cm 0.1
m 0.001
km 0.000001
in 0.03937008
ft 0.00328084
yd 0.001093613
mi 6.2137e-7
nmi 5.3996e-7

The conversions that are exact by definition

These are not measurements — they are definitions agreed by international treaty, so they are exact to any number of decimal places you care to write.

ConversionExact valueSince
1 inch25.4 mm exactlyInternational yard and pound agreement, 1959
1 foot0.3048 m exactly1959
1 yard0.9144 m exactly1959
1 mile1,609.344 m exactly1959
1 pound (avoirdupois)0.453 592 37 kg exactly1959
1 US gallon3.785 411 784 L exactlyDefined as 231 cubic inches
1 nautical mile1,852 m exactlyInternational agreement, 1929

A US survey foot differed from the international foot by 2 parts per million and was officially retired at the end of 2022. It still appears in older US land records, where over long distances the difference is measurable.

The gallon problem, and other same-name traps

Several units share a name across systems while differing substantially in size. Getting one wrong is a silent error — the number looks plausible.

The gallon is the worst offender. A US liquid gallon is 3.785 L; an imperial gallon is 4.546 L — about 20% larger. US fluid ounces and imperial fluid ounces differ too, but in the opposite direction (29.57 mL versus 28.41 mL), so US measures are smaller by the ounce and larger by the count. A US pint is 16 fl oz; an imperial pint is 20.

The ton has three meanings: a US short ton (907.18 kg), an imperial long ton (1,016.05 kg), and a metric tonne (1,000 kg exactly). Spelling is the only clue, and it is inconsistently applied.

For data, the kilobyte is genuinely ambiguous: 1,000 bytes under SI, or 1,024 bytes in the binary convention that IEC standardised as the kibibyte (KiB) in 1998. Storage manufacturers use decimal, most operating systems report binary, and the gap compounds — it is 2.4% at kilo and 10% by tera. This is the entire reason a "2 TB" drive shows as roughly 1.82 TB in Windows. Nothing is missing; the two are counting differently.

Temperature — the one with an offset

Every other conversion here is a simple multiplication. Temperature scales have different zero points as well as different degree sizes, which is why you cannot convert a temperature *difference* the same way you convert a temperature.

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

°C
Celsius — zero at the freezing point of water
°F
Fahrenheit — 32 at the freezing point of water
K
Kelvin — zero at absolute zero. K = °C + 273.15

Worked example

Convert
37 °C (body temperature)
Calculation
(37 × 9/5) + 32

98.6 °F

A *difference* of 1 °C equals a difference of 1.8 °F, with no offset — the +32 applies only to absolute temperatures. −40 is the single point where both scales agree.

About

The Unit Converter supports nine measurement categories — Length, Weight/Mass, Temperature, Area, Volume, Speed, Data Size, Pressure, and Energy — covering every common unit in both the metric (SI) and imperial systems. Select a category, enter your value and source unit, and instantly see the result in any target unit. The "All conversions" table below the main converter shows every unit in the selected category at once, making it easy to compare values across systems. All conversions happen locally in your browser with no rounding until display.

How to use

  1. 1 Click a category tab (Length, Weight, Temperature, etc.) to select the measurement type.
  2. 2 Enter a value in the "From" field and select your source unit from the dropdown.
  3. 3 Select the target unit in the "To" field — the converted value updates instantly.
  4. 4 Click ⇄ to swap the from/to units.
  5. 5 Scroll to the "All conversions" table to see the value expressed in every available unit.
How do I convert Celsius to Fahrenheit?
Select the Temperature category, enter your °C value in the From field with °C selected, then choose °F in the To field. The formula is °F = °C × 9/5 + 32. For example, 100°C = 212°F (boiling point of water). The converter also supports Kelvin and Rankine.
How do I convert km to miles?
Select the Length category, enter your value with km selected as the source unit, then choose mi (miles) as the target. 1 km = 0.621371 miles. The converter supports all common length units: mm, cm, m, km, inches, feet, yards, miles, and nautical miles.
What is the difference between MB and MiB?
In the Data Size category, MB uses the SI definition (1 MB = 1,000,000 bytes = 10⁶ bytes), while MiB (mebibyte) uses the binary definition (1 MiB = 1,048,576 bytes = 2²⁰ bytes). Hard drive manufacturers typically use SI (decimal) prefixes, while operating systems often report in binary. The converter shows both.
Are all conversions accurate?
Yes — all conversion factors are based on exact SI definitions or widely accepted exact values (e.g., 1 inch = 25.4 mm exactly). Temperature conversions use exact formulas. The displayed values are rounded to 7 significant figures for readability; the underlying calculation uses JavaScript double-precision floating point.