AIBOX

Unit Converter

Convert between units of length, mass, volume, area, speed, temperature, data size and time, with the result updating as you type. Every factor here is a definition value — 1 inch is exactly 25.4 mm because an agreement says so, not because someone measured it — so nothing on this page can go stale or be overtaken by a market. Data sizes are printed in decimal and binary prefixes side by side, because "500 GB" on a drive label and "465 GiB" in a file manager are the same bytes read two ways. Temperatures below absolute zero are computed and reported rather than quietly clamped.

Eight categories, 76 units in total. Changing this rebuilds the two unit lists below from the same table this page calculates with, and resets them to that category's usual pair.

Digits, a decimal point and an optional minus sign. Scientific notation such as 1e9 is accepted too. Press Ctrl/⌘ + Enter to convert without leaving the keyboard.

Filled from the unit table of the category above; the list changes with it.

Use the swap button below to convert the other way round without retyping anything.

Significant digits, not decimal places — one page has to span 1 nanometre and 1 kilometre, and the integer part of a result is never truncated.

Nothing you type is sent to us: the whole conversion runs in the tab you already have open, which is also why there is no usage limit. See our privacy policy.

How to use it

  1. Pick the category first, then the two units. The category decides which units exist: there is no sensible single list that holds nanometres, kilojoules, kibibytes and degrees Fahrenheit at once, so the two unit lists are rebuilt from the category's own table. The pair you get by default for each category is the one people reach for most often — metres to feet, kilograms to pounds, gigabytes to gibibytes.
  2. Type the value and read the answer as you go. The result updates with every keystroke, so you can watch a number turn into the shape you expected instead of discovering later that the units were the wrong way round. The line above the rows is the whole conversion in one sentence: what you typed, and what it is.
  3. Read the notes before trusting a disagreement. The yellow panel is where this page says what it did on your behalf and what it refused to assume: the definition value behind the factor, the two byte conventions when the category is data size, an input with more digits than a double holds, and the two cases where the displayed answer is not quite the input any more.
  4. Use "Swap the units" instead of retyping. Typing the result into the other box by hand is the step where a digit goes missing, and it also loses the fact that you were checking a round trip.
  5. Change the precision when the default is not what you need. Eight significant digits is right for a quick answer and wrong for a figure that has to survive being copied into a report. The precision control changes the display only; the machine result underneath is always shown next to it, so you can see exactly how much the rounding took off.

How the conversion is actually calculated

Every ratio category on this page is converted through a single base unit, in three steps. It is worth stating explicitly, because it explains both the accuracy and the failure modes.

  1. Value into the base unit. The entered number is multiplied by the factor of the unit you chose. Length uses the metre, mass the kilogram, volume the litre, area the square metre, speed metres per second, time the second, and data size the byte.
  2. Base unit into the target. The base value is divided by the factor of the unit you asked for.
  3. Clean, then format. The result is rounded to 14 significant digits to remove binary floating-point noise, and then written out at the precision you selected.

So a conversion from inches to centimetres is 1 x 0.0254 / 0.01, which is 2.54. The factor line in the result panel gives you the combined ratio directly — 1 in = 2.54 cm — which is the number to check against a reference table if you doubt the answer.

Temperature is the exception

Celsius and Fahrenheit cannot be expressed as a factor, because their zero points do not mean the same thing. Going through kelvin, the conversion is K = °C + 273.15 and K = (°F + 459.67) / 1.8, so the result is the base value run backwards through the target's formula. The offset is written out in full rather than folded into a constant, and the pair of formulas is chosen so that the four physical anchors — 0 °C, 100 °C, −40 and absolute zero — each convert back to exactly the number you started from rather than to a value one unit in the last place away from it.

The eight categories, and how many units each holds

CategoryBase unitUnitsExamples of what is in it
Lengthmetre11m, km, cm, mm, µm, nm, in, ft, yd, mi, nmi
Mass and weightkilogram11kg, t, g, mg, µg, lb, oz, st, ct, US ton, UK ton
Volumelitre14L, m³, mL, cm³, US and UK gallons, quarts, pints, cups, fluid ounces, tablespoons, teaspoons
Areasquare metre10m², km², cm², mm², ha, acre, in², ft², yd², mi²
Speedmetre per second5m/s, km/h, mph, ft/s, knots
Temperaturekelvin4°C, °F, K, °R
Data sizebyte12B, bit, kB, MB, GB, TB, PB, KiB, MiB, GiB, TiB, PiB
Timesecond9s, ns, µs, ms, min, h, day, week, Julian year

Those counts and the lists next to them are not a summary written by hand and left to rot: the page prints the whole unit list for the category you selected, generated from the same module the arithmetic comes from, and the counts above are checked against that module by the test suite. If a unit is ever added, the table either follows or the build fails.

Why the factors are definitions and not measurements

There is a line running through this site, and unit conversion sits right on it. A number in a tool is only honest if you can say where it came from. For conversions that means the factor has to be a definition — a value fixed by an agreement or a standard — rather than a measurement or a price.

The definitions used here are all of that kind:

  • 1 in = 25.4 mm, exactly, by the 1959 international yard and pound agreement. That single line fixes the inch, the foot, the yard, the mile and the square mile, and it is why 1 mi is exactly 1609.344 m rather than approximately something.
  • 1 lb = 0.45359237 kg, exactly, by the same agreement. The ounce, stone, US ton and UK ton all follow from it by whole-number ratios.
  • 1 US gal = 231 in³, by an 1836 Act of Congress, which fixes the quart, pint, cup, fluid ounce, tablespoon and teaspoon in the US system.
  • 1 nmi = 1852 m, by the 1929 International Convention on the Metre — it was defined so that one minute of latitude would be one nautical mile.
  • 1 acre = 4840 yd² and 1 ha = 10000 m², both by definition rather than survey.
  • 1 KiB = 1024 B, by IEC 80000-13, along with the whole binary prefix ladder.
  • 1 Julian year = 365.25 day, by IAU convention, and stated here as the Julian year rather than as "a year" because the two are not the same length.

None of these can drift. Putting them in a page is the same act as putting them in a standard document — which is exactly what makes them different from the numbers this site refuses to publish.

What is deliberately absent, and why

Four kinds of unit are missing from the lists, and each absence is a decision that was made rather than an oversight.

  • Currencies and anything else that moves. A currency conversion rate is a price rather than a definition. It changes every second, and a page that prints a fixed one is either stale or invented. We have not found a feed we would be willing to cite, so the conversion is not offered — see the note on the converters category page.
  • Historical and regional units. The Chinese chi, cun, jin and mu, the older European ell and league, and the many regional pounds: each of those words meant different lengths and masses in different places and centuries. There is no basis for calling one of them the correct one, and choosing from memory would hand you a confident wrong answer, which is worse than not answering.
  • Calendar months and years. A month is 28 to 31 days; a calendar year is 365 or 366. Converting either into seconds requires an extra assumption about which one you meant, so the time list holds only the fixed units plus the Julian year, and labels that one honestly.
  • Mach number. The speed of sound depends on air temperature and pressure, so Mach 1 is a condition rather than a fixed speed. Knots and miles per hour are in the list because they are definitions; Mach is not, because it is not.

What is left over is a converter that does arithmetic over agreed constants and says so. Run it twice on the same input in ten years and you will get the same answer, which is the only kind of stability a conversion tool can honestly promise.

Decimal and binary: why 1 GB is not 1 GiB

This is the most common reason two people looking at the same disk disagree about its size, and it is a naming problem rather than a measuring problem. SI prefixes have always stepped by a power of ten: kilo means 1000, mega a million, giga a billion. When computer memory turned out to be addressed in powers of two, the same prefixes were borrowed and quietly redefined to mean 1024, 1,048,576 and so on — and for a generation both meanings were in circulation.

IEC 80000-13 settled it in 1998 by giving the binary ladder its own names. kB is 1000 bytes, KiB is 1024 bytes, and the difference compounds: at the gigabyte level it is already 7.4%.

Decimal (SI)BytesBinary (IEC)BytesDifference
1 kB1,0001 KiB1,0242.4%
1 MB1,000,0001 MiB1,048,5764.9%
1 GB1,000,000,0001 GiB1,073,741,8247.4%
1 TB1,000,000,000,0001 TiB1,099,511,627,77610.0%

So a drive sold as 500 GB holds 500,000,000,000 bytes, and a file manager that reports in gibibytes divides that by 1,073,741,824 and shows 465.66 GiB. Both numbers are correct; one of them is in the unit the label did not use. Enter 1 with GB and GiB selected on this page and it prints both readings of the same byte count without choosing a winner — which is the only honest way to present a disagreement that comes from the units rather than from the arithmetic.

Two more details worth knowing. First, bit is in the list because network speeds are quoted in bits per second: 1 bit is one eighth of a byte, so a 100 Mbit/s line moves at most 12.5 MB/s. Second, kB and KB are not distinguished on this page, because they are not consistently distinguished anywhere: the SI-correct symbol for the decimal kilobyte is kB, and the capital form is used loosely for both meanings in the wild.

Temperature: the one category that is not a ratio

Doubling 20 °C does not give 40 °C of anything, and 0 °C is not the absence of heat — it is the temperature at which water happens to freeze, which is a convention. Only two of the scales on this page start at a real zero, and their names say so: kelvin, the SI base unit, and degrees Rankine, which is the Fahrenheit-sized version of the same idea.

Because of that, Celsius and Fahrenheit are handled with a pair of formulas rather than a factor. The conversion goes through kelvin:

FromTo kelvinFrom kelvin
CelsiusK = °C + 273.15°C = K − 273.15
FahrenheitK = (°F + 459.67) / 1.8°F = K x 1.8 − 459.67
KelvinK = KK = K
RankineK = °R / 1.8°R = K x 1.8

The four anchors you can check by hand are the freezing point (0 °C = 32 °F = 273.15 K), the boiling point (100 °C = 212 °F = 373.15 K), the point where the two scales agree (−40 °C = −40 °F), and absolute zero (−273.15 °C = −459.67 °F = 0 K). Convert any of those and then convert the answer back: the number you get is the one you typed, not something a hair away from it. That matters more than it sounds. A converter whose round trip misses by one part in a quadrillion looks fine in a single conversion and produces nonsense the moment you chain two of them, or compare a converted value against a threshold.

There is a second, subtler trap in the Fahrenheit formula: the + 459.67 is large compared with a small input, so converting 0.001 °C to Fahrenheit and back loses precision to cancellation. An absolute error of 2.4e-14 is nothing in absolute terms, but it is 2.4e-11 relative to the value you entered, and the round-trip line reports both so you can judge it instead of being alarmed by a number with eleven zeros in it.

Precision, rounding and floating-point noise

A page that has to cover nanometres and kilometres cannot round to a fixed number of decimal places, because the same setting that makes 1 m readable destroys 1 nm. So the precision control is in significant digits — 4, 6, 8, 10 or 12, defaulting to 8 — and the rules around it are stated rather than implied.

  • The integer part is never truncated. 1 GB in bytes is written 1000000000, not 1.0000000e+9. A precision setting is a statement about how much detail to show, not a licence to replace a number with a rounded one.
  • Trailing zeros are dropped. 0.30000000 is written 0.3, because the zeros carry no information.
  • Beyond 1e16 or below 1e-6 the page switches to scientific notation, since a long run of zeros is easier to miscount than an exponent.
  • Each step is cleaned to 14 significant digits. Binary floating point cannot represent 0.1 or 0.3 exactly, so 0.1 m converted to micrometres comes out of the machine as 100000.00000000001. Fourteen digits is shorter than the 15 to 17 that a double carries and longer than any measurement ever reaches, so this removes the noise without touching a meaningful digit. Whenever it changes the value, the raw machine result is printed next to the cleaned one — the panel row labelled "Machine result".
  • Two round-trip checks, not one. The first converts the full-precision result back and compares it with your input exactly. The second converts the displayed number back, which is what anyone copying from the screen would actually get, and accepts it if it agrees at the current precision. Reporting only the exact check would flag 1 m = 3.2808399 ft as "not equal to your input" when both numbers on screen read as 1 — a warning that teaches people to distrust the tool rather than the rounding.

One consequence worth stating plainly: the number in the "Result" row is a formatted value, and the machine result row is the actual double from the arithmetic. If you are feeding an answer into another calculation, use the machine result; if a human is going to read it, use the formatted one.

What this converter refuses to read as a number

Input parsing is boring right up to the moment it silently changes the answer, so this page rejects the ambiguous forms instead of guessing. Each rejection is a specific message, not a generic "invalid input".

InputWhy it is refusedWhat to type instead
1,000A comma is a decimal point in much of Europe and South America. The same characters mean one thousand to one reader and one to another, so accepting it would mean choosing a locale silently.1000
1 000 or 1_000Spaced and underscored grouping is a formatting convenience with no agreed meaning in a numeric field.1000
0x1F, 0b1010, 0o17These are alternative notations for a number, not alternative quantities. A converter converts quantities.The decimal value
1e308 converted from metres to nanometresThe conversion overflows: the result would be infinite. Printing the word "Infinity" in a result field is worse than producing no result, because it looks like an answer.A smaller value, or a smaller unit
1e-320 converted from kilometres to nanometresThe intermediate value underflows to zero, so the result would carry no information at all.A larger value, or a larger unit
five, or a value with a unit glued on such as 5 kgNot a number. The tool will not guess where the digits stop and the unit begins, because guessing wrong is invisible.The digits in the value field and the unit in the unit field
Infinity, NaNNeither is a number you can convert, and neither is ever allowed to appear in an output field.A finite value

Three inputs that are accepted, and are worth knowing about: a leading minus sign (negative magnitudes are computed and flagged rather than refused, because a temperature of −40 is ordinary and a negative difference is ordinary), scientific notation such as 1e9 or 2.5E-3, and a number with more significant digits than a double can hold, which is computed anyway with a note saying how many digits were read and what the value was taken to be.

What leaves this page

Nothing. The page is a static file that imports one module of pure functions: the conversion, the rounding, the unit lists, the round-trip check and the notes all run in the tab you already have open. There is no request to our server, no analytics event carrying your value, no cookie and no storage. Reload the page and everything is gone, because it was never anywhere else.

That is a small claim for a unit converter and a large one for the category it belongs to. Sooner or later this category will hold conversions of things people would rather not paste into a website — sizes from a private document, a measurement from a medical report, a value from a contract. The reason the browser-only rule is applied here from the first tool is that it is much easier to keep than to retrofit.

Two things this page genuinely cannot protect are still worth naming: the browser's own memory of what you typed into a field, and the clipboard if you press the copy button. Those are outside any web page's reach, including this one.

Common questions

Where do the conversion factors come from?
From definitions rather than measurements. 1 inch is exactly 25.4 millimetres because the 1959 international yard and pound agreement says so, 1 pound is exactly 0.45359237 kilograms by the same agreement, the US gallon has been 231 cubic inches by statute since 1836, and IEC 80000-13 defines 1 KiB as exactly 1024 bytes. A definition cannot drift, so putting it in the page is the same act as putting it in a standard document. Temperature is represented differently because it is an affine scale rather than a proportional one: the offset is written out explicitly in the formula shown above the result.
Why does 1 GB come out as 0.93132257 GiB?
Because GB and GiB are two different units with confusingly similar names. GB uses an SI prefix that steps by 1000, so 1 GB is exactly 1,000,000,000 bytes. GiB uses an IEC binary prefix that steps by 1024, so 1 GiB is exactly 1,073,741,824 bytes. Divide one by the other and you get 0.9313225746154785, which is 0.93132257 at eight significant digits. The reason the two numbers cause arguments is that drive manufacturers quote the decimal one (it is the larger figure) while most operating systems report the binary one. This page prints both readings of the same byte count at the same prefix level, so the relationship is visible rather than implied.
Why can I not convert temperature by multiplying by a factor?
Because temperature scales with a zero point that was chosen rather than found. 0 °C is the freezing point of water, and 0 °F is a brine mixture Fahrenheit happened to pick; neither is the absence of heat. Only the Kelvin and Rankine scales start at absolute zero, and that is why those two behave like ordinary ratio units while Celsius and Fahrenheit do not. The page therefore treats Celsius and Fahrenheit as affine: a scale factor plus an offset. The consequence you can check is on the four physical anchors — freezing, boiling, −40, and absolute zero — where the round trip back to the unit you started from returns exactly the number you typed, not a value one part in a quadrillion away.
What happens if I convert a temperature below absolute zero?
It computes the answer and then says so. Entering −300 °C gives −26.85 K with a note that the input sits below the lowest possible value on that scale, which is −273.15 °C. The alternative — silently clamping the input to absolute zero — would produce a plausible-looking number and hide the fact that the input was wrong, which is exactly the failure this page is organised against. The same reasoning applies at the other end: a value that overflows the range a browser can represent is refused with a message rather than printed as the word "Infinity".
How is the precision chosen, and why significant digits instead of decimal places?
Because one page has to span 1 nanometre and 1 kilometre. Rounding to a fixed number of decimal places destroys the small end of that range, and a fixed number of integer digits destroys the large end. Significant digits are scale-independent, so the control is in those: 4, 6, 8, 10 or 12, defaulting to 8. The integer part of a result is never truncated — 1 GB in bytes is written 1000000000, not 1.0000000e+9 — and beyond 1e16 or below 1e-6 the page switches to scientific notation because a long run of zeros is easier to misread than an exponent. Each conversion is additionally cleaned to 14 significant digits, which strips binary floating-point noise such as 100000.00000000001 without shortening anything a measurement could actually reach, and whenever that cleaning changes the value the raw double is printed next to the cleaned one.
Is anything I type sent to you?
No. The page is a static file that imports one module of pure functions; the conversion, the rounding, the unit lists and the notes all run in the tab you already have open. There is no request to our server, no analytics event carrying your value, no cookie and no storage, so reloading the page discards everything. That is also why there is no usage limit: a conversion costs us nothing to run, whether you use it once or a thousand times.

No conversion tables ship with this page. Every factor, every unit list and every result above is read from the same module of pure functions the test suite runs, so a number cannot be right on the page and wrong in the tests.