Cat Toolbox
Help CatBlog About Partnership 中文

Unit and Base Converters: Factors, Display Rounding and the Edges of the Range

CalculatorUpdated 2026-09-29

These two pages both call themselves converters, and the word hides the difference that matters. The unit converter does floating-point arithmetic on top of a table of definitions: some of those factors are exact by international agreement, some are averages, and its output is formatted for reading rather than for arithmetic. The base converter does something of a different kind — it re-spells the same integer in another base, using arbitrary-precision integers, so nothing inside its range can be wrong and the only interesting question is where the range ends.

That split is why the advice differs. For units, the things to watch are conventions and display: which gallon, which ton, and how many digits survive. For bases, the only real constraint is 2⁵³−1, and it is enforced rather than approximated.

Every number in this guide was read out of the two pages' own scripts and then produced by driving the pages.

What each page actually stores

The unit converter holds eight categories and 77 units in total. Each unit is a single number: its size in the category's base unit.

Category Units Base unit
Length 16 metre
Weight 11 kilogram
Temperature 3 — (see below)
Area 11 square metre
Volume 12 litre
Speed 6 metre/second
Time 9 second
Data storage 9 byte

Converting is then value × from-factor ÷ to-factor, in one step. Nothing is converted through an intermediate unit of measure, so no error accumulates along a chain — the single factor you are using is the whole story.

The base converter stores no table at all. It parses whatever you type into an integer of arbitrary size, checks it against the limit, and re-spells it in the other three bases.

Factors that are definitions and factors that are averages

Exact, because the units are defined in terms of each other:

  • 1 inch = 0.0254 m, 1 foot = 0.3048 m, 1 yard = 0.9144 m, 1 mile = 1609.344 m
  • 1 pound = 0.45359237 kg, 1 ounce = 0.0283495231 kg
  • 1 nautical mile = 1852 m, 1 knot = 0.5144444 m/s, 1 mph = 0.44704 m/s
  • Chinese market units, at their legal metric equivalents: 1 li = 500 m, 1 zhang = 10/3 m, 1 chi = 1/3 m, 1 cun = 1/30 m, 1 jin = 0.5 kg, 1 mu ≈ 666.6667 m²

Averages and conventions, which is where readings disagree between tools:

  • Gallon, quart, pint, fluid ounce, cup, tablespoon, teaspoon are US liquid measures. 1 gal = 3.785412 L, 1 tbsp = 0.0147868 L, 1 tsp = 0.00492892 L. The imperial gallon (4.54609 L) is not in the list.
  • Ton means metric tonne (1000 kg). Neither the US short ton (907.18 kg) nor the UK long ton (1016.05 kg) is available.
  • Mach is 343 m/s, the speed of sound at sea level around 20 °C. In cold air at altitude it is lower, so a Mach reading is only as good as that assumption.
  • A year is 31536000 s — exactly 365 days — and a month is 30 days. Useful for rates, wrong for calendars. 12 months therefore equals 360 days, which the page reports as 0.986301 year, and 366 days reports as 1.00274 year.

The window, and a second rule most people never notice

The result box is read-only, and the number in it is formatted by magnitude:

Value How it is shown
0.001 up to 1,000,000 up to six decimals, trailing zeros removed
1,000,000 or larger, or below 0.001 scientific notation, four decimals
below 1e-10 in absolute value 0
not a finite number —

Two details hide in that table. The upper bound is exclusive, so a result of exactly one million does not get plain digits: 1 km² is shown as 1.0000e+6 m², 1 m³ as 1.0000e+6 mL, 1 km as 1.0000e+6 mm. And there is a second rule that is not in the page's own description: even inside the window, if the six-decimal form is longer than twelve characters it is replaced by scientific notation as well. 1 Meter = 39.370079 Inch stays plain (eight characters), but:

Conversion Exact result Shown as
7 km → inches 275590.55118110… 2.7559e+5
1 chi → micrometres 333333.33333333… 3.3333e+5
123456 mi → km 198683.172864 1.9868e+5
1 lb → tonnes 0.00045359237 4.5359e-4

All four are inside the 0.001-to-1,000,000 window and still come back in scientific notation. If you need plain digits, pick a target unit that lands the result in the readable middle.

Rounding happens in the display, not in the arithmetic

The factors keep full precision internally; only the text you read is rounded. 1 pound converts with the factor 0.45359237 and the page shows 0.453592 — six decimals, and the factor line underneath shows the same rounded number, so the digits you can copy are the digits you can use.

That has two consequences worth holding on to. First, converting once is more accurate than converting twice by hand, because the second step starts from a number that has already lost digits. Second, the formulas printed in this guide are the ones the page applies; if your work needs more than six decimals, use the definitions above directly rather than the display.

Data storage: binary throughout, with one row that does not fit

This category uses powers of 1024, the convention operating systems report in: 1 KB = 1024 B, 1 TB = 1024 GB, 1 B = 8 bits. The awkward readings all come from the same place — the window — rather than from the factors:

  • 1 GB → TB shows 9.7656e-4 (below 0.001, so scientific)
  • 1000 GB → TB shows 0.976563
  • 1 TB → bytes shows 1.0995e+12

One row is genuinely different. The petabyte factor is stored as 1.1258999e15, while 2⁵⁰ is 1125899906842624 — the constant is 6,842,624 bytes short, about 0.0006 %. So 1 PB converts to 1023.999994 TB, not 1024. Everything up to the terabyte is consistent within the 1024 convention; the petabyte is a rounded stand-in, and a petabyte-scale calculation that expects exact binary multiples will be off in the sixth digit.

Temperature is the one category with no factor

Celsius, Fahrenheit and Kelvin have different zero points, so a single multiplier cannot describe the relationship. The page routes every conversion through Celsius — (°F − 32) × 5/9 in, °C + 273.15 for Kelvin — and the line under the box shows that formula instead of a factor. The exchange rates worth knowing:

Input Result
37 °C 98.6 °F, 310.15 K
0 °F 255.372222 K
0 K −273.15 °C, −459.67 °F
37 K −236.15 °C, −393.07 °F

Selecting the same unit on both sides passes the value through unchanged and says so, rather than running the formula.

What the line under the box is telling you

That line is a factor readout, not a restatement of your sum: it always describes one unit. Twelve months converted to days shows 1 Month = 30 Day while the result box says 360. It is also built by cutting each label at its first parenthesis, which is why Li (Chinese mile) appears as Li and 里 (市里) as 里.

Because it obeys the same formatting rules, the factor line itself can go scientific — 1 cun = 3.3333e-5 km, 1 jin = 5.0000e-4 tonne — which is correct but reads as less precise than it is.

The controls, and what they keep

  • Swap exchanges the two unit selections and keeps the number. 2 km → cm reads 200000; after swapping, 2 cm → km reads 2.0000e-5; swapping back gives 200000 again. Nothing drifts, because each calculation starts from your number and the factors, not from the displayed ratio.
  • Changing category resets the two selections to the first two units of the new category but keeps what you typed. A 2 that meant 2 km becomes 2 °C the moment you switch to temperature, and reads 35.6 °F. Re-check the units after every category change, not just the number.
  • Input handling: an empty box or non-numeric text is treated as zero rather than reported as an error; negative values convert normally (−1 km → -1000); a literal that overflows, such as 1e400, is shown as —. The output box cannot be edited.

Base converter: the arithmetic is exact, the range is the only limit

Parsing and formatting both go through arbitrary-precision integers, so digits never pass through a floating-point number. That means the page cannot be imprecise inside its range — it can only refuse.

The ceiling is 9,007,199,254,740,991, which is 2⁵³−1, the largest integer a double-precision number can hold without loss. Here is that ceiling in all four bases:

Base Value
BIN 1111111111111111… (53 ones)
OCT 377777777777777777
DEC 9,007,199,254,740,991
HEX 1FFFFFFFFFFFFF

Binary therefore stops at 53 digits, and 2⁵³ itself (9007199254740992) is refused rather than rounded. The check is done on the exact integer, so an entry of two hundred digits is parsed in full and then rejected — it is never silently shortened.

The box you are typing in keeps your text

The field you edit is left exactly as you typed it; the other three are rewritten in canonical form. Two consequences:

  • Leading zeros stay where you put them. Typing 00001010 into BIN leaves 00001010 in that box while the others show 10 (DEC), 12 (OCT) and A (HEX). Typing 007 into DEC leaves 007 there and shows 7 in the readout. The zeros are dropped in the fields the page fills, not in the one you are using.
  • Hex case is preserved on input. Typing abc into HEX leaves abc in that box; a HEX field filled from another field is upper case (FF, 1FFFFFFFFFFFFF).

Three failures, three different behaviours

What you did What happens
Illegal character (0x1A, -1, 1.5, 1 255) That box is flagged; the other three keep the last valid result, and so does the readout
Value above 2⁵³−1 That box is flagged; the other three are cleared, and the readout is replaced by a red out-of-range message
Field emptied Everything is cleared and the readout returns to its prompt

The distinction between the first two is deliberate: a half-typed number should not destroy the result you were about to copy, while an out-of-range number must not leave a stale answer on screen next to it.

One rough edge: after an out-of-range entry, the flagged box stays red while you work in another field, even though it is empty. It clears the next time you type in that box, or when you press Clear All.

Keys, copy buttons, and the readout

  • Escape in a field clears that field and resets the other three along with it.
  • Clear All does the same from the button row and also removes any error flags.
  • One copy button per field. The tooltip (Copied / 已复制) fades after about 1.2 seconds.
  • The decimal readout groups digits with English commas in both language versions — 2,748 and 9,007,199,254,740,991 — because the grouping is fixed in the code rather than taken from your system locale.
  • Spaces: leading and trailing spaces are trimmed and accepted (255 converts as 255); a space inside the number is not, and 1 255 is flagged.

Which page for which job

  • Use the unit converter for cooking, travel, screen and paper sizes, land areas, data transfer rates and anything phrased in the units of a datasheet — and read its factor table when the number matters.
  • Do not use its year and month units for calendar work: 365-day years and 30-day months are averages. The date calculator handles real calendars, including leap days.
  • Use the base converter for bit masks, colour values, file headers and memory addresses. Remember that it is unsigned and integral by design: negative numbers (no two's complement) and fractions are out of scope.
  • If you need more than six significant digits, take the exact definition from this page and do the arithmetic once, rather than copying a rounded display value forward.

FAQ

Why does 1 km² show as 1.0000e+6 m² instead of 1000000? The plain-digit window ends just below one million. Exactly one million is already in the scientific band, so the display switches four digits early. The value is right; only the notation changes.

How many units does the converter have in total? 77 across eight categories: 16 length, 11 weight, 3 temperature, 11 area, 12 volume, 6 speed, 9 time and 9 data storage. The two language versions use the same numbers — only the labels differ.

Which gallon, which ton, which cup? US liquid gallon (3.785412 L), metric tonne (1000 kg), US cup (0.236588 L), US tablespoon and teaspoon. Imperial gallons, short tons, long tons and imperial cups are not available.

Is 1 PB equal to 1024 TB here? No — this is the one reading that breaks the pattern: the petabyte factor is a rounded 1.1258999e15 rather than exactly 2⁵⁰, so 1 PB shows 1023.999994 TB. Through the terabyte, the 1024 convention holds exactly.

Why did my factor line change to 4.5359e-4? The line is formatted by the same rules as the result, and 0.00045359237 is below 0.001, so it is displayed in scientific notation with four decimals.

Can I convert millilitres to grams here? Not as a unit conversion: that crosses categories and needs a density. Water is about 1 g/mL, but oil, honey and flour are not, so the page keeps volume and mass separate.

Why is the maximum 9,007,199,254,740,991? Because that is 2⁵³−1, the last integer a double-precision floating-point number can represent exactly. Numbers above it may have neighbours that share the same stored value, so the page refuses them instead of returning something subtly wrong.

Why does the hex box keep showing lower case after I type abc? The box you are typing in is never rewritten — that is what lets you keep editing without the text jumping around. Hex values the page produces for you are upper case; hex you type stays as you typed it.

Does the base converter handle negative numbers or fractions? No. The input is a string of digits in the base implied by the field, so a minus sign and a decimal point are both flagged as illegal characters. Convert the magnitude and apply the sign yourself, or scale the fraction into an integer first.

Tools used in this guide

Advertisement