Skip to content
Varlig Guide
Varlig home

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:

calc
12 inches in cm gives 30.48 cm
5 miles to km gives 8.04672 km
2 lb as g gives 907.18474 g
250 g -> kg gives 0.25 kg
1.5 L → mL gives 1,500 mL
convert 6 feet into cm gives 182.88 cm
1.8m→cm gives 180 cm

Metric 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:

calc
12 centimetres in inches gives 4.7244094488 inches
3 decilitres in mL gives 300 mL
2 tonnes in kg gives 2,000 kg

A unit name on its own means one of that unit, which is a quick way to look up a conversion factor:

calc
mile in km gives 1.609344 km
kg in lb gives 2.2046226218 lb

Naming 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:

calc
metres in 10 km gives 10,000 m
grams in 2 kg gives 2,000 g
minutes in 3 hours gives 180 min

Conversions can be chained. Each step converts the answer so far, so the last unit wins:

calc
2.5 m -> cm -> mm gives 2,500 mm

Units 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:

calc
1 μm in nm gives 1,000 nm
1 ångström in nm gives 0.1 nm
20 ˚C in F gives 68 °F
10 lb·ft in N·m gives 13.5581794833 N·m
30 mi/gal in L/100km gives 7.840486119 L/100km

deg 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:

calc
cos(30 deg) gives 0.8660254038
30 deg in radians gives 0.5235987756 rad
1/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:

calc
5 km in miles gives 3.1068559612 mi
5 km in miles to 2 dp gives 3.11 mi
100 km/h in mph to 0 dp gives 62 mph
1.7 m in ft to 1 dp gives 5.6 feet
900 mm in inches to 1 dp gives 35.4 inches
8 km to miles to 1 dp gives 5 mi

The 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 into only works in the convert … into … phrase. Elsewhere, use in or to.
  • A number in front of the target unit changes the question. 2 m in feet converts, while 2 m in 3 feet counts how many three-foot lengths fit and shows the plain 2.1872265967.
  • Symbols are case-sensitive. MB is a megabyte and Mb is a megabit, so 100 Mb in MB is 12.5 MB.
  • pint, gal, quart, cup and fl oz are US measures. For British pints, gallons, quarts and fluid ounces, put UK, imp or imperial in 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 kg names bananas, and so does 21 L in bottles, until you say what a bottle holds. Words around a calculation are still fine, as in 5 lbs of potatoes in kg or 65 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).
calc
1 UK pint in ml gives 568.26125 mL
1 pint in ml gives 473.176473 mL
3 bananas in kg gives Unsupported: unknown unit: bananas
21 L in bottles gives Unsupported: unknown unit: bottles
2 hours in meetings gives 2 hours

An 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:

calc
1000 mg four times a day in g gives 4 g/day
4000 mg/day in g gives 4 g/day
8 oz in ml gives 236.5882365 mL

Arithmetic 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 g works, and the answer is shown in the larger of the two units. Add in … to choose a different one. A plain number takes the unit of the quantity beside it, so 300 + 20 km is 320 km.
  • Multiplying and dividing combines units. A length times a length is an area, and by works 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.
calc
1 kg + 500 g gives 1.5 kg
500 mL + 2 L gives 2.5 L
1km + 1,000m gives 2 km
300 + 20 km gives 320 km
3 kg - 250 g in g gives 2,750 g
2.5 kg * 4 gives 10 kg
4 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 L
2 kW * 3 hours gives 6 kWh
10 km/h * 30 min gives 5 km
120 km / 80 km/h gives 1.5 hours
1 kg / 250 g gives 4
1 km > 900 m gives true

Answers 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:

calc
3 kW * 4 min gives 0.2 kWh
600 kcal/hour * 45 min gives 450 kcal
5000 mAh / 500 mA gives 10 hours
64 kWh / 7.4 kW gives 8.6486486486 hours
2.5 kg * 9.81 m/s² * 12 m gives 294.3 J
1 / 0.02 s in Hz gives 50 Hz

Adding quantities of different kinds is an error:

calc
2 km + 2 kg gives Error: incompatible units: can't add km and kg

Dividing 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:

calc
5 mL / 50 gal gives 0.1 mL/gal
5 mL / 50 gal * 60 gal gives 6 mL
1 ml per 40 l * 200 l gives 5 mL
500 mL / 2 L gives 0.25

A 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:

calc
2 kW * 3 hours in W*h gives 6,000 W·hour
1 GB / (50 MB/s) gives 20 s

Units 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.

calc
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 J
1 kg·m²/s² in J gives 1 J
1 N in kg*m/s^2 gives 1 kg·m/s²
5 · 3 gives 15

Base 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:

calc
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 J

Dividing 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:

calc
0.27 m / (0.04 W/mK) gives 6.75 m²·K/W
1 / (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.

calc
(3 m)^2 gives 9 m²
sqrt(25 m^2) gives 5 m
cbrt(27 m^3) gives 3 m
sqrt(100 m²/s²) gives 10 m/s
sqrt(4 m^3) gives Error: unsupported multiplicative unit

Functions 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.

calc
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 ha
1 km² in hectares gives 100 ha
0.5 m³ in L gives 500 L
1 ft³ in L gives 28.316846592 L
1 g/cm³ in kg/m³ gives 1,000 kg/m³
18 km/h + 5 m/s gives 10 m/s

An 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:

calc
30 m² / 12 sq m/L gives 2.5 L
450 sq ft / 400 sq ft/gal gives 1.125 gal
40 m² * 35 g/m² in kg gives 1.4 kg

Sizes 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:

calc
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 L
2-1/2" in mm gives 63.5 mm

Millimetre 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:

calc
11 x 14 in in cm gives 27.94 × 35.56 cm
11 x 14 in in cm² gives 993.5464 cm²
9x5 inch loaf pan in cm gives 22.86 × 12.7 cm
1 1/2" x 3 1/2" in mm gives 38.1 × 88.9 mm

When 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:

calc
6 x 2.4 m gives 14.4 m
2 x 5 km gives 10 km
4 x 400 m gives 1,600 m
8 x 50 m gives 400 m
3 x 1.2 m in ft gives 11.811023622 feet

Varlig 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:

calc
5'10" in cm gives 177.8 cm
5'10 in cm gives 177.8 cm
6'2" gives 6 feet 2 inches
5 foot 10 gives 5 feet 10 inches
5 ft 10 in gives 5 feet 10 inches
5 ft 10 in in cm gives 177.8 cm
5 lb 4 oz gives 5 lb 4 oz
7 lb 4 gives 7 lb 4 oz
7 lb 3 oz in kg to 2 dp gives 3.26 kg
11 stone 4 pounds in kg to 1 dp gives 71.7 kg
14 stone 7 in kg to 1 dp gives 92.1 kg
14st 7lb in kg to 1 dp gives 92.1 kg
82 kg in stones and pounds gives 12 st 13 lb
12.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:

calc
3.6 m / 16 in rounded up gives 9
10 m / 3 in to 0 dp gives 131

A 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:

calc
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:

calc
2 uk gal in L gives 9.09218 L
2 imp pt in ml gives 1,136.5225 mL
1 UK fl oz in ml gives 28.4130625 mL
1 imperial quart in L gives 1.1365225 L
1 UK gallon in UK pints gives 8 UK pt
2 US gal in L gives 7.570823568 L

A 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:

calc
180 cm in feet and inches gives 5 feet 10.87 inches
500 g in lb and oz gives 1 lb 1.64 oz
170 cm in feet and inches to 0 dp gives 5 feet 7 inches
1.7 m in feet and inches to 1 dp gives 5 feet 6.9 inches

Temperature

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:

calc
180 °C in °F gives 356 °F
350 °F in °C to 0 dp gives 177 °C
37 °C in °F gives 98.6 °F
32 F in C gives 0 °C
-40 C in F gives -40 °F
20 °C in K gives 293.15 K
20 degC in degF gives 68 °F
180 degrees Celsius in Fahrenheit gives 356 °F
375 degrees in C gives 190.5555555556 °C
375F in c gives 190.5555555556 °C
98.6 f to c gives 37 °C
37.5c in F gives 99.5 °F
gas mark 6 gives 200 °C

A 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:

calc
18 °C + 5 °C gives 23 °C
18 °C + 5 K gives 23 °C

A 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 °C is 5 °C, and converting that to Fahrenheit gives 41 °F, not a 9-degree change.
  • Multiplying by a plain number scales the number (20 C * 2 is 40 °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:

calc
unit mug = 250 mL gives 250 mL
6 mugs in L gives 1.5 L
1 can = 330 mL gives 330 mL
3 cans in mL gives 990 mL

Write 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:

calc
unit mug = 250 mL gives 250 mL
1.5 L in mugs gives 6 mugs

For 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:

calc
55 L in buckets of 10 L gives 5.5 buckets
864 L in bags of 50 L rounded up gives 18 bags

A 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:

calc
1 L in 200 mL gives 5
2 hours in 15 min gives 8

A custom unit can be built from another custom unit, and the conversion factors multiply:

calc
1 can = 330 mL gives 330 mL
1 case = 24 cans gives 24 cans
2 cases in L gives 15.84 L

Generic units

A generic unit has no physical size: it counts things, such as guests, slices or tickets. Declare one with new unit:

calc
slice = new unit gives slice
3 slices + 5 slices gives 8 slices
24 slices / 8 slices gives 3
£36 / 24 slices gives £1.50

Dividing 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.

calc
2-3 kg gives 2 - 3 kg
2-3 kg in lb gives 2 - 3 kg

A 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:

calc
10 km - 12 km gives -2 km

A 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:

calc
# Raised bed for the vegetable patch
bed length = 2.4 m
bed width = 1.2 m
bed depth = 30 cm
bed length * bed width gives 2.88 m²
soil = bed length * bed width * bed depth in L gives 864 L
1 bag = 50 L gives 50 L
soil in bags rounded up gives 18 bags
edging = 2 * (bed length + bed width) gives 7.2 m
1 board = 1.8 m gives 1.8 m
edging in boards rounded up gives 4 boards

Mixing 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.