Units and conversions
Any number in a calc block can carry a unit: 250 g, 1.8 m, 20 °C, 100 Mbps. Once it
has one, Varlig keeps track of it through the maths, so a length times a length is an area and
a distance divided by a speed is a time. This page covers writing units, converting between
them, doing arithmetic with them and defining your own. Reach for it whenever a calculation
involves measurements: a recipe, a room, a journey, a download or a body weight.
Money has its own page, Money and currencies, and speeds, paces and fuel economy are covered in Rates, speed, pace, fuel and transfer time.
Attaching and converting units
Write the unit after the amount, with or without a space: 65 kg and 65kg are the same. To
convert, add in, to, as, -> or → and the unit you want, or write the phrase
convert … into …. All of these do the same job:
12 inches in cm gives 30.48 cm5 miles to km gives 8.04672 km2 lb as g gives 907.18474 g250 g -> kg gives 0.25 kg1.5 L → mL gives 1,500 mLconvert 6 feet into cm gives 182.88 cm1.8m→cm gives 180 cmMetric units can be spelled out the British or the American way, so centimetres,
millilitres, litres and tonnes are as good as cm, mL, L and t:
12 centimetres in inches gives 4.7244094488 inches3 decilitres in mL gives 300 mL2 tonnes in kg gives 2,000 kgA unit name on its own means one of that unit, which is a quick way to look up a conversion factor:
mile in km gives 1.609344 kmkg in lb gives 2.2046226218 lbNaming the unit first asks the same question the way you’d say it out loud, which is the quick way to count the smaller units in a larger one:
metres in 10 km gives 10,000 mgrams in 2 kg gives 2,000 gminutes in 3 hours gives 180 minConversions can be chained. Each step converts the answer so far, so the last unit wins:
2.5 m -> cm -> mm gives 2,500 mmUnits copied from a datasheet or a web page work as they are. The Greek μ is read as micro,
˚C and ℃ as degrees Celsius, ångström as Å, and a compound unit keeps its meaning
however its parts are joined, so lb·ft, lb-ft and ft·lb are all a torque and mi/gal is a
fuel economy:
1 μm in nm gives 1,000 nm1 ångström in nm gives 0.1 nm20 ˚C in F gives 68 °F10 lb·ft in N·m gives 13.5581794833 N·m30 mi/gal in L/100km gives 7.840486119 L/100kmdeg on its own is the angle, so it works in a conversion and inside a trigonometric function,
while deg C and deg F stay temperatures. A turn is a whole revolution, the way fasteners
and valves are described:
cos(30 deg) gives 0.866025403830 deg in radians gives 0.5235987756 rad1/4 turn in degrees gives 90°Rounding a converted answer
Metric and imperial units rarely divide evenly, so conversions often produce long decimals.
Add to N dp after the conversion to round the answer:
5 km in miles gives 3.1068559612 mi5 km in miles to 2 dp gives 3.11 mi100 km/h in mph to 0 dp gives 62 mph1.7 m in ft to 1 dp gives 5.6 feet900 mm in inches to 1 dp gives 35.4 inches8 km to miles to 1 dp gives 5 miThe rounded answer stays in the unit you converted to, whether you write in miles or
to miles. The rounded value is used if you carry the answer into later lines. See
Rounding for the other ways to round.
Conversion pitfalls
- The word
intoonly works in theconvert … into …phrase. Elsewhere, useinorto. - A number in front of the target unit changes the question.
2 m in feetconverts, while2 m in 3 feetcounts how many three-foot lengths fit and shows the plain2.1872265967. - Symbols are case-sensitive.
MBis a megabyte andMbis a megabit, so100 Mb in MBis12.5 MB. pint,gal,quart,cupandfl ozare US measures. For British pints, gallons, quarts and fluid ounces, putUK,imporimperialin front. See UK and US measures.- A word that isn’t a unit shows an error when you convert it, so a typo can’t quietly give a
wrong answer. That works both ways round:
3 bananas in kgnamesbananas, and so does21 L in bottles, until you say what a bottle holds. Words around a calculation are still fine, as in5 lbs of potatoes in kgor65 kg in pounds for the team, and so is saying what an amount measures or what you spent time on (1.2 m in length,2 hours in meetings).
1 UK pint in ml gives 568.26125 mL1 pint in ml gives 473.176473 mL3 bananas in kg gives Unsupported: unknown unit: bananas21 L in bottles gives Unsupported: unknown unit: bottles2 hours in meetings gives 2 hoursAn amount that comes with a period keeps it, so converting a dose or an allowance changes only the unit. Ounces converted to a volume are fluid ounces, as a US recipe means them:
1000 mg four times a day in g gives 4 g/day4000 mg/day in g gives 4 g/day8 oz in ml gives 236.5882365 mLArithmetic with units
You can add, subtract, multiply, divide and compare quantities. The rules follow the physics:
- Adding and subtracting needs the same kind of quantity (two masses, two lengths). The
units don’t have to match:
1 kg + 500 gworks, and the answer is shown in the larger of the two units. Addin …to choose a different one. A plain number takes the unit of the quantity beside it, so300 + 20 kmis 320 km. - Multiplying and dividing combines units. A length times a length is an area, and
byworks between two lengths the way room sizes are written (4 m by 3 m). Power times time is energy, and a distance divided by a speed is a time. Units that appear on both sides of a division cancel out, leaving a plain number. - Comparing with
>,<or==also needs the same kind of quantity, and converts before it compares.
1 kg + 500 g gives 1.5 kg500 mL + 2 L gives 2.5 L1km + 1,000m gives 2 km300 + 20 km gives 320 km3 kg - 250 g in g gives 2,750 g2.5 kg * 4 gives 10 kg4 m * 3 m gives 12 m²4 m by 3 m gives 12 m²3 m * 4 m * 2.5 m in L gives 30,000 L2 kW * 3 hours gives 6 kWh10 km/h * 30 min gives 5 km120 km / 80 km/h gives 1.5 hours1 kg / 250 g gives 41 km > 900 m gives trueAnswers come out in the unit you’d use for them. Power over minutes or hours is energy in watt-hours, a rate of calories times a time is calories, a battery’s capacity over a current or a power lasts hours, and a force over a distance is work in joules:
3 kW * 4 min gives 0.2 kWh600 kcal/hour * 45 min gives 450 kcal5000 mAh / 500 mA gives 10 hours64 kWh / 7.4 kW gives 8.6486486486 hours2.5 kg * 9.81 m/s² * 12 m gives 294.3 J1 / 0.02 s in Hz gives 50 HzAdding quantities of different kinds is an error:
2 km + 2 kg gives Error: incompatible units: can't add km and kgDividing two amounts of the same kind normally cancels the units, as 1 kg / 250 g shows.
The exception is a dose: a tiny amount spread through a much larger one keeps both units, so a
feed or a dilution stays readable and multiplies back out:
5 mL / 50 gal gives 0.1 mL/gal5 mL / 50 gal * 60 gal gives 6 mL1 ml per 40 l * 200 l gives 5 mL500 mL / 2 L gives 0.25A small amount measured into millilitres or cubic centimetres reads per litre instead, the way
a concentration is quoted: 0.00243 mol / 25.0 cm³ is 0.0972 mol/L.
When units don’t cancel, the answer keeps a compound unit. You can convert a compound unit by
joining the target units with *, and it helps to put a rate in brackets when you divide by
it:
2 kW * 3 hours in W*h gives 6,000 W·hour1 GB / (50 MB/s) gives 20 sUnits from a textbook or datasheet
Constants and material properties come with dots, slashes, brackets and superscripts. Paste
them in as they’re printed: *, · and ⋅ all multiply, ^ and superscripts both raise a
power, and a bracketed denominator groups everything inside it.
6.674e-11 N*m^2/kg^2 gives 6.674e-11 N·m²/kg²4186 J/(kg K) gives 4,186 J/(kg·K)4186 J/kg/°C * 0.5 kg * 20 °C gives 41,860 J1 kg·m²/s² in J gives 1 J1 N in kg*m/s^2 gives 1 kg·m/s²5 · 3 gives 15Base units that spell out a named unit take its name, so 5 kg·m/s² is 5 N. Ask for them
back and you get the form you wrote, which is how 1 N in kg*m/s^2 reads.
Heat capacities and U-values are often written with the kelvin run on to the unit before it, with no dot. That still reads as a product:
0.04 W/mK gives 0.04 W/(m·K)0.16 W/m2K gives 0.16 W/(m²·K)4186 J/kgK * 0.5 kg * 20 °C gives 41,860 JDividing by one of these gives a single tidy quotient, and one over a quotient turns it over, so a thickness and a conductivity become a thermal resistance and that resistance becomes a U-value:
0.27 m / (0.04 W/mK) gives 6.75 m²·K/W1 / (6.75 m²·K/W) gives 0.1481481481 W/(m²·K)Powers and roots
Raising a quantity to a power raises its unit too. Square and cube roots work when the unit divides evenly: the square root of an area is a length, and the square root of a speed squared is a speed, but the square root of a volume has no sensible unit and is an error.
(3 m)^2 gives 9 m²sqrt(25 m^2) gives 5 mcbrt(27 m^3) gives 3 msqrt(100 m²/s²) gives 10 m/ssqrt(4 m^3) gives Error: unsupported multiplicative unitFunctions such as sin, ln and exp expect a plain number (or an angle, for the
trigonometric functions), so sin(1 kg) is an error.
Squares, cubes and powers
There are several ways to write squared and cubed units. They all mean the same thing:
| Meaning | Accepted forms |
|---|---|
| Square metres | m^2, m2, m², sq m, sqm, square meters, square metres |
| Cubic metres | m^3, m³, cu m, cubic meters, cubic metres |
| In a unit rate | 9.81 m/s^2, 1 cm/s², 1 kg/m³ (powers work in denominators too) |
sq runs together with the unit too, so sqm, sqft, sqcm, sqyd, sqmi and sqin are
the same units as sq m and sq ft.
20 m² in sq ft to 0 dp gives 215 ft²20 sqm in sq ft to 0 dp gives 215 ft²100 sq ft in m² gives 9.290304 m²40 m * 25 m in hectares gives 0.1 ha1 km² in hectares gives 100 ha0.5 m³ in L gives 500 L1 ft³ in L gives 28.316846592 L1 g/cm³ in kg/m³ gives 1,000 kg/m³18 km/h + 5 m/s gives 10 m/sAn area over a coverage rate is how much you need to buy, which is how paint, sealant and lawn feed are sold. Write the rate as the tin does, in either system:
30 m² / 12 sq m/L gives 2.5 L450 sq ft / 400 sq ft/gal gives 1.125 gal40 m² * 35 g/m² in kg gives 1.4 kgSizes written with by or x
Rooms, sheet materials and picture frames are written as two or three numbers with one unit at
the end. Write the size the way it’s printed and Varlig gives every side that unit, then
multiplies them into an area or a volume. by, x and × all work, and x can touch its
numbers the way loaf tins and photo sizes are written:
4 by 3 m gives 12 m²1200 x 2400 mm gives 2.88 m²20 mm x 30 mm gives 600 mm²1200 x 600 x 300 mm gives 0.216 m³3 m × 4 m × 2.5 m in L gives 30,000 L2-1/2" in mm gives 63.5 mmMillimetre and centimetre sides that come to a million or more square or cubic of them show in square or cubic metres, which is why a 1200 by 2400 sheet reads as 2.88 m². Smaller ones keep the unit you wrote.
Converting a size to another length converts each side on its own, so a frame or a tin stays the shape it is. Convert to an area instead when you want the sides multiplied:
11 x 14 in in cm gives 27.94 × 35.56 cm11 x 14 in in cm² gives 993.5464 cm²9x5 inch loaf pan in cm gives 22.86 × 12.7 cm1 1/2" x 3 1/2" in mm gives 38.1 × 88.9 mmWhen the first number is a whole count of something much longer, it counts them instead of measuring a side. That’s how timber and cable are written on a shopping list:
6 x 2.4 m gives 14.4 m2 x 5 km gives 10 km4 x 400 m gives 1,600 m8 x 50 m gives 400 m3 x 1.2 m in ft gives 11.811023622 feetVarlig counts when the longer number has a decimal part, is at least ten times the count, is in
kilometres or miles, or is a round training distance in metres: a multiple of 25 at least four
times the count, which is how a swim or track session is written. Everything else measures
sides, so 10 x 25 m is a 250 m² room, and by, three or more numbers and a conversion to an
area or volume always measure them (6 x 2.4 m in m² is 14.4 m², the same fourteen metres of
board seen as an area).
A size in a smaller unit in front of a length in a larger one describes what you’re buying
rather than adding to it, so 15mm copper 12 m is twelve metres of 15 mm pipe. Two parts of
one measurement still add up: 1 m 20 cm is 1.2 m.
Heights and weights in feet, stones and pounds
Imperial heights and weights are often written in two parts. Varlig reads them as one quantity:
5'10" in cm gives 177.8 cm5'10 in cm gives 177.8 cm6'2" gives 6 feet 2 inches5 foot 10 gives 5 feet 10 inches5 ft 10 in gives 5 feet 10 inches5 ft 10 in in cm gives 177.8 cm5 lb 4 oz gives 5 lb 4 oz7 lb 4 gives 7 lb 4 oz7 lb 3 oz in kg to 2 dp gives 3.26 kg11 stone 4 pounds in kg to 1 dp gives 71.7 kg14 stone 7 in kg to 1 dp gives 92.1 kg14st 7lb in kg to 1 dp gives 92.1 kg82 kg in stones and pounds gives 12 st 13 lb12.5 st gives 12 st 7 lb' means feet and " means inches, or write ft, foot and in. The second part can go
without its unit, the way heights and weights are said out loud: 5'10, 5 foot 10 and
7 lb 4 each take the smaller unit from the first part. Spaces are optional, so 14st 7lb
works as well as 14 stone 7 lb.
In 5 ft 10 in in cm, the first in is the inches and the second converts the height. A
number followed by in at the end of a line, before an operator or before a rounding phrase is
inches too, so screen = 55 in stores 55 inches, screen in cm gives 139.7 cm and
3.6 m / 16 in rounded up counts the 16-inch spacings across a 3.6 m ceiling:
3.6 m / 16 in rounded up gives 910 m / 3 in to 0 dp gives 131A weight in stones shows stones and pounds; for a decimal, convert it with in stone.
Measurements in feet and inches multiply like any others, which is handy for a room measured with an imperial tape:
14 ft by 12 ft gives 168 ft²6 in * 6 in gives 36 in²12'6" * 10'3" gives 128.125 ft²12 ft 6 in by 10 ft 3 in gives 128.125 ft²12'6" * 10'3" in m² to 1 dp gives 11.9 m²UK and US measures
Gallons, quarts, pints and fluid ounces come in two sizes. On their own they’re the US measures,
as in an American recipe. Put UK, imp or imperial in front for the British ones. Capitals
don’t matter, so 2 UK Pints works as well as 2 uk pints:
2 uk gal in L gives 9.09218 L2 imp pt in ml gives 1,136.5225 mL1 UK fl oz in ml gives 28.4130625 mL1 imperial quart in L gives 1.1365225 L1 UK gallon in UK pints gives 8 UK pt2 US gal in L gives 7.570823568 LA UK gallon is exactly 4.54609 litres, and holds 4 quarts, 8 pints or 160 fluid ounces. Before
ton, UK and imperial mean the long ton of 1,016 kg, and US ton is the short ton. Cups
and spoons have no UK size, so 2 UK cups shows an unknown unit rather than quietly giving a US
answer. For a cup of 250 mL, write metric cup. Car fuel economy has a UK size too: UK mpg is
miles per UK gallon (see Fuel economy).
Two-unit answers
To see an answer split across two units, as people usually say heights, weights and
durations, convert to both units joined by and or &:
| Target | Example | Answer |
|---|---|---|
feet and inches |
70 inches in feet and inches |
5 feet 10 inches |
pounds and ounces |
2.5 lb as pounds and ounces |
2 lb 8 oz |
stones and pounds |
82 kg in stones and pounds |
12 st 13 lb |
hours and minutes |
135 minutes in hours and minutes |
2 hours 15 min |
minutes and seconds |
200 seconds as minutes and seconds |
3 min 20 s |
days and hours |
50 hours as days and hours |
2 days 2 hours |
weeks and days |
50 days as weeks and days |
7 weeks 1 day |
months and days |
45 days as months and days |
1 month 15 days |
months and weeks |
100 days as months and weeks |
3 months 1 week |
years and months |
500 days as years and months |
1 year 4 months |
Symbols work as well as names, so 70 inches in ft and in, 2.5 lb in lb and oz and
82 kg in st and lb all split the answer.
Durations round to the nearest whole smaller unit, so 89.9 min in hours and minutes is
1 hour 30 min, and stones and pounds show whole pounds. Feet and inches, and pounds and
ounces, keep the fraction a metric starting value usually leaves, shown to two decimal places.
Add to N dp for fewer: the decimal places apply to the smaller unit, so you get a height you
can read out:
180 cm in feet and inches gives 5 feet 10.87 inches500 g in lb and oz gives 1 lb 1.64 oz170 cm in feet and inches to 0 dp gives 5 feet 7 inches1.7 m in feet and inches to 1 dp gives 5 feet 6.9 inchesTemperature
Celsius and Fahrenheit don’t start at zero, so converting between them involves an offset as well as a scale. Varlig handles that for you:
180 °C in °F gives 356 °F350 °F in °C to 0 dp gives 177 °C37 °C in °F gives 98.6 °F32 F in C gives 0 °C-40 C in F gives -40 °F20 °C in K gives 293.15 K20 degC in degF gives 68 °F180 degrees Celsius in Fahrenheit gives 356 °F375 degrees in C gives 190.5555555556 °C375F in c gives 190.5555555556 °C98.6 f to c gives 37 °C37.5c in F gives 99.5 °Fgas mark 6 gives 200 °CA plain degrees converted to a scale is a reading on the other one, which is how ovens and
thermometers get written down: 375 degrees in C treats the 375 as Fahrenheit, and
180 degrees in F treats the 180 as Celsius.
You can write Celsius as C, °C, ºC, ˚C, ℃, degC, celsius, degrees C,
degrees Celsius or centigrade, Fahrenheit as F, °F, ºF, ˚F, ℉, degF,
fahrenheit, degrees F or degrees Fahrenheit, and kelvin as K or kelvin. C always means Celsius, except when you
convert an electric charge, where in C gives coulombs. A lowercase c straight after a number
can also mean cents, so Varlig reads the line. It’s Celsius in a conversion to a temperature
(37.5c in F), next to another temperature, and on its own for a decimal, a negative number or
100 and over (180c). Next to money, before a rate, or for a whole number up to 99 on its own
(99c), it’s cents. See Cents and pence. Oven gas marks follow the UK table;
see Kitchen measures and oven settings.
Adding a change in temperature works when both amounts use the same scale. For a Celsius reading you can also add kelvin, because a change of 1 K is the same size as 1 °C:
18 °C + 5 °C gives 23 °C18 °C + 5 K gives 23 °CA few things to watch for:
- Keep both sides of a sum in the same scale. Adding a Fahrenheit amount to a Celsius reading doesn’t give a meaningful answer.
- Subtracting two readings gives another reading, not a difference.
20 °C - 15 °Cis5 °C, and converting that to Fahrenheit gives41 °F, not a 9-degree change. - Multiplying by a plain number scales the number (
20 C * 2is40 °C), but multiplying two temperatures together, or a temperature by another unit, is refused.
Unit families
Varlig recognises a large catalogue of units. The main families are:
| Family | Examples |
|---|---|
| Length | mm, cm, m, km, in, ft, yd, mi, NM, AU |
| Area | m², ha, acres, sq ft, sqm |
| Volume | mL, L, m³, tsp, tbsp, cup, pint, UK pint, fl oz, UK fl oz, gal, UK gallon |
| Mass | mg, g, kg, t, oz, lb, stone, long ton |
| Time | s, min, hours, days, weeks, fortnights, months, years, decades |
| Speed | km/h, mph, m/s, knots, Mach |
| Data | MB, GB, GiB, Mbps, MB/s |
| Energy | J, kJ, kcal, Wh, kWh, BTU, therm |
| Power | W, kW, hp, bhp |
| Pressure | Pa, kPa, bar, psi, atm, mmHg |
| Electricity | V, A, mA, mAh, Ω, Hz |
The complete list of symbols and spelled-out names, family by family, is in the unit catalogue. When you’re unsure of a spelling, the symbol is the safest choice.
Custom units
You can define a unit of your own in terms of an existing quantity, then use it like any other
unit. Write unit or 1, then the name and what it equals. Both forms do the same job, so use
whichever reads better in your note:
unit mug = 250 mL gives 250 mL6 mugs in L gives 1.5 L1 can = 330 mL gives 330 mL3 cans in mL gives 990 mLWrite the name in the singular or the plural, whichever reads naturally: 1 mug and 6 mugs
both work.
A custom unit is also a conversion target, so you can ask how many of them something makes. That’s the quick way to count mugs from a jug or tiles for a wall:
unit mug = 250 mL gives 250 mL1.5 L in mugs gives 6 mugsFor a one-off you don’t need to declare anything. Say the size in the same line with
in … of …, and add rounded up when a part-filled one still counts:
55 L in buckets of 10 L gives 5.5 buckets864 L in bags of 50 L rounded up gives 18 bagsA sized amount of the same kind counts the same way, and the answer is a plain number of them, because the unit cancels. That covers a jug into glasses, a reel into lengths and a block of time into sessions:
1 L in 200 mL gives 52 hours in 15 min gives 8A custom unit can be built from another custom unit, and the conversion factors multiply:
1 can = 330 mL gives 330 mL1 case = 24 cans gives 24 cans2 cases in L gives 15.84 LGeneric units
A generic unit has no physical size: it counts things, such as guests, slices or tickets.
Declare one with new unit:
slice = new unit gives slice3 slices + 5 slices gives 8 slices24 slices / 8 slices gives 3£36 / 24 slices gives £1.50Dividing money by a count gives the price of one. As with custom units, the singular and plural both work. Generic units can’t be converted to physical units.
Unit ranges
A line such as 2-3 kg is read as a range and shown as 2 - 3 kg. Ranges are for display
only: they don’t convert, and they don’t take part in arithmetic.
2-3 kg gives 2 - 3 kg2-3 kg in lb gives 2 - 3 kgA smaller number, a dash and a larger number with a unit is taken as a range, so 10 - 12 km
is a range rather than minus 2 km. To subtract, put the unit on both numbers:
10 km - 12 km gives -2 kmA band of percentages works differently: 5-10% of £200 and 88% to 94% of 265 W do the sum
twice and give you both ends. See Percentages.
Putting it together
Here’s a note for building a raised bed in the garden. It works out how much soil to buy in 50-litre bags and how many 1.8 m edging boards go around the outside:
# Raised bed for the vegetable patchbed length = 2.4 mbed width = 1.2 mbed depth = 30 cmbed length * bed width gives 2.88 m²soil = bed length * bed width * bed depth in L gives 864 L1 bag = 50 L gives 50 Lsoil in bags rounded up gives 18 bagsedging = 2 * (bed length + bed width) gives 7.2 m1 board = 1.8 m gives 1.8 medging in boards rounded up gives 4 boardsMixing metres and centimetres is fine: the volume comes out in cubic metres and in L turns it
into litres. Defining a bag and a board as units lets you convert straight into them, and
rounded up gives whole ones, because you can’t buy part of a bag. Change bed depth to
45 cm and every answer below it updates.