📐 Unit Converter
Convert between different units of measurement.
🔒 100% client-side processing
Unit conversion is daily friction: a recipe lists grams while your measuring cups are in ounces, a spec sheet gives inches while your tape measure is metric, or a wind report quotes knots when you think in miles per hour. This converter covers 57 units across eight categories and recalculates as you type — no submit button, no sign-up, and no page reload.
How the Conversion Math Works
Every category defines one base unit: the meter for length, the kilogram for weight, the liter for volume, the square meter for area, meters per second for speed, the second for time, and the byte for data. Each unit carries a single toBase factor saying how many base units it equals. To convert, the tool multiplies your value by the source factor and divides by the target factor:
result = value × from.toBase ÷ to.toBase
Because both factors are fixed definitions, going through the base unit and back out never loses information beyond normal floating-point rounding. A mile is 1609.344 meters and a kilometer is 1000 meters, so 1 mile becomes 1609.344 ÷ 1000 = 1.609344 km.
Normalising through a base unit is what keeps the converter compact. Storing a factor for every ordered pair of units would grow quadratically — ten length units would need ninety factors instead of ten. With one toBase number per unit, any pair needs at most two multiplications, and correcting a single definition fixes every conversion that relies on it at once. The swap button simply exchanges the source and target selections and recalculates, and changing the category rebuilds both dropdowns and defaults the target to the second unit in that category’s list.
Worked Examples
| Input | Conversion | Result |
|---|---|---|
| 1 mile | miles → kilometers | 1.609344 km |
| 70 kg | kilograms → pounds | 154.323584 lb |
| 100 °F | Fahrenheit → Celsius | 37.7777777778 °C |
| 1 acre | acres → square meters | 4046.86 m² |
| 60 mph | miles/hour → km/hour | 96.5607 km/h |
| 1 GB | gigabytes → megabytes | 1024 MB |
| 10 stone | stone → kilograms | 63.5029 kg |
| 30 knots | knots → km/h | 55.5599 km/h |
| 1 tbsp | tablespoons → milliliters | 14.7868 mL |
The pounds figure comes from 70 ÷ 0.453592; the temperature from (100 − 32) × 5/9; the knots figure from 30 × 0.514444 ÷ 0.277778. Both are computed at full double precision and only rounded for display. Kitchen conversions are a good illustration of why source and target factors matter equally: 1 tablespoon is 0.0147868 liters and 1 milliliter is 0.001 liters, so the result is 0.0147868 ÷ 0.001 = 14.7868 mL.
Why Temperature Is Different
For every multiplicative category, converting is a single multiplication. Temperature is the exception because the three scales do not share a zero point. The tool first normalizes the input to Celsius, then converts out:
- Celsius to Fahrenheit:
F = C × 9/5 + 32 - Fahrenheit to Celsius:
C = (F − 32) × 5/9 - Celsius to Kelvin:
K = C + 273.15 - Kelvin to Celsius:
C = K − 273.15
After normalization it checks for results below absolute zero (less than −273.15 °C) and rejects them, so you cannot accidentally convert −500 °C into a nonsensical Kelvin value. This is also why temperature has no toBase multiplier in the underlying data — the three entries carry a factor of 1 and are handled by the offset branch instead.
The Data Size Category Uses 1024
The Data Size category uses powers of 1024: 1 KB = 1024 B, 1 MB = 1,048,576 B, 1 GB = 1,073,741,824 B, and 1 TB = 1,099,511,627,776 B. This is the binary convention, the one operating systems generally use when they report file sizes. Note the naming mismatch: storage vendors and network engineers often use the decimal convention (1 GB = 1000 MB). A hard drive advertised as 1 TB therefore shows up as about 931 GB in a binary-based file manager. The labels here say KB/MB/GB/TB but the arithmetic is binary, so treat results as GiB-equivalents when comparing against vendor specifications.
Common Mistakes and Edge Cases
- Cross-category guesses. Grams to milliliters is not a unit conversion; it needs density. The tool deliberately keeps categories separate rather than offering a misleading one-to-one.
- Two kinds of ounce. Ounce (weight) and fluid ounce (volume) live in different categories, and a US fluid ounce (29.5735 mL) differs from an imperial one.
- US versus imperial volume. The Volume category contains both gallon variants. Mixing them up skews a recipe by around 20%.
- Fixed-length months and years. Time uses 30-day months and 365-day years, not the calendar. Date arithmetic is out of scope.
- Scientific notation. A value like 1 micrometer converted to miles is tiny and displays as
6.2137e-10rather than a long string of zeros. - Negative temperatures near absolute zero. Values at or below −273.15 °C are rejected with an error, but values just above it convert normally — −273 °C becomes 0.15 K.
- Assuming a “ton” is always metric. The Weight category uses the metric ton (1000 kg); the US short ton (907.18474 kg) and imperial long ton are not included.
Precision and Limits
Ordinary results are shown to as many as 10 decimal places with trailing zeros stripped, so 1.609344 stays readable instead of ending in noise. Inputs at or above 1×10^10, and nonzero inputs below 1×10^-6, are displayed in scientific notation with six significant figures. Only the display is shortened — the calculation itself uses full IEEE-754 double precision. The practical ceiling is therefore not accuracy but the fact that all conversions are linear within a category, which is true for the units offered here.
Two behaviours are worth knowing. First, results are formatted for display only; if you copy a rounded figure into another calculation you inherit that rounding, so keep full precision in the source when chaining conversions. Second, there is no automatic unit detection — the tool converts exactly the pair you select, and the output field is read-only, so the value you compare against is always the result of a single defined conversion rather than an inferred or “best” unit.
Related Tools
Frequently Asked Questions
Does the converter treat a kilobyte as 1000 or 1024 bytes?
It uses 1024-based multiples throughout the Data Size category: 1 KB = 1024 B, 1 MB = 1024 KB, 1 GB = 1024 MB, and so on. That is the binary convention often labelled KiB/MiB/GiB. Storage manufacturers usually quote decimal sizes (1 GB = 1000 MB), which is why an operating system may report a '1 TB' drive as roughly 931 GB.
Why do temperature conversions need a different formula?
Celsius, Fahrenheit, and Kelvin have different zero points, so they cannot be converted by multiplying by a single factor. The tool converts the input to Celsius first, then to the target scale, using F = C × 9/5 + 32 and K = C + 273.15. It also rejects any result below absolute zero (−273.15 °C).
Can I convert grams to milliliters, or other cross-category pairs?
No. Conversions are scoped to one category at a time, because grams measure mass and milliliters measure volume. Turning one into the other requires the substance density (for water, roughly 1 g/mL; for oil, about 0.92 g/mL), which a general unit converter cannot infer.
How different are the US and imperial gallons?
Noticeably: 1 US gallon is exactly 3.785411784 liters, while 1 imperial gallon is 4.54609 liters, about 20% larger. Both appear in the Volume category, alongside US quarts, pints, cups, fluid ounces, tablespoons, and teaspoons.
How many decimal places does the result show?
Ordinary values are shown to up to 10 decimal places with trailing zeros removed. Values of 1×10^10 or larger, and values smaller than 1×10^-6, switch to scientific notation with six significant figures.
Which units does each category contain?
There are 57 units in eight categories: length, weight, temperature, volume, area, speed, time, and data size. They range from micrometers and milligrams up to nautical miles and terabytes, mixing metric and imperial units in the same category.
Reviewed by the HandyTools Hub team · Last updated