Rules for entering the expressions in the smart unit converter

The dynamic unit converter is designed to understand the user input as a mathematical expression. There are no specific hard and fast rules for the input. In most cases, it should understand the expressions similar to what Microsoft excel can solve. But since it involves the unit keywords to be treated as variables in the expression, there are some exceptions to these rules.

In addition to these exceptions, the program takes some assumptions from the input data if the unit conversion in question has temperature units involved in it.

Input String Format

  1. Every input string must have " TO " in it. This is to differentiate between Converting From unit  and Converting to unit expression. For Example
    • 100 kg to grams   ( o.k.)
    • 100 kg tograms    ( Invalid: there must be an empty space both before and after  "to" )

Rules for the using expressions.

  1. Unit Keywords are case sensitive.
    • mm is millimeter while Mm is Mega meter.
  2. A space between two numerical will combine the number. ( why? -> see rule # 16)
    • 123 456 is treated as 123456 and NOT as 123*456
  3. An empty space between the two units or between a numerical number and a unit is translated as a multiply sign. For example:
    • 30 meter will be treated as 30*meter
    • m s is same as m*s.
      • Note that ms is not equal to meter*second, instead, it will be treated as millisecond.

Temperature Conversions 

  1. If the units in the input string are pure temperature units, then temperature conversions are done using the standard methods. For instance, temperature conversion from °F to K uses the expression T [K] = (T[°F] + 459.67)/1.8 
    • Example: 1.13 °F = (1.13 + 459.67)/1.8 = 460.8/1.8 = 256 K
  2. If the units in the input string are temperature units mixed with other units, then the temperature units in the string will be treated as delta temperatures. For instance, temperature conversion between °F to K use the expression ?T[in K] = ?T[in °F]/1.8.  This can be easily derived as:
    • T1 [K] = (T1[in °F] + 459.67)/1.8
      T2 [K] = (T2[in °F] + 459.67)/1.8
      Using ?T[K] = T1 [K] - T2[K]
      => ?T[K]  = (T1[in °F] + 459.67)/1.8  -  (T2[in °F] + 459.67)/1.8
      => ?T[K]  = (T1[in °F] - T2[in °F] )/1.8
      =     ?T[in °F]/1.8.
    • Example: 1 Btu/°F to J / K  =  (1055.87 J) / ( 1/1.8 K) = 1900.566  J/K .

Supported Math operators

  1. Add operator: '+'
  2. Subtract operator: '-'
  3. Multiply operators:
    • '*'
    • ' ', i.e. an empty or a white space; An empty space is treated as a multiply operator when placed between two units or between a unit and a constant. Note: For the purpose of multiplication, consecutive empty spaces will be treated as a single multiply sign. Also, an empty space on either side of an operator will be ignored. i.e. 2 m + 3 mm equals 2*m+3*mm and not as 2*m*+*3*mm!
    • '·', i.e. the half high dot (Unicode character # 00B7, Hint: type 00B7 then ALT+X in MS word). Note a half high dot is not same as a decimal point i.e. '.'
  4. Divide operators:
    • ' / '
    • 'per'
  5. Power Operator: ^
    • Note: A unit can not be raised to another unit. i.e. m^m is invalid.
  6. Other helpful keywords: This includes
    • 'cube'  :
    • 'square', 'squared' :  Will be translated as ' ^2 '. Note: For now, square & cube keywords are supported only if they are placed after the base unit or number.  i.e.
      • "meter square to cm square" is accepted as good input.
      • "square meter to square cm" is currently not supported (Will be addressed in future)


  1. To be updated...


Math based tools

Other math based tools