Converts a temperature between Celsius, Fahrenheit, Kelvin, and Rankine using the exact NIST SP 811 defining formulas.
Published for review. The Founder is checking every card himself; anything he strikes comes down the same hour.
Try it
Inputs
value (number, from_unit, required) : The temperature to convert
from_unit (string, required) one of: C, F, K, R : Unit of the input value
to_unit (string, required) one of: C, F, K, R : Unit to convert into
Outputs
result (to_unit): The converted temperature
Steps
Convert the input to Celsius: C=C if from_unit is C; C=(F-32)*5/9 if F; C=K-273.15 if K; C=(R-491.67)*5/9 if R (since R=F+459.67).
Convert Celsius to the target unit: F=C*9/5+32; K=C+273.15; R=(C+273.15)*9/5; C=C.
Round the result to 2 decimal places (the conventional precision for temperature).
Constants
celsius_to_kelvin_offset = 273.15 K (source: Guide for the Use of the International System of Units (SI))
fahrenheit_scale_factor = 1.8 F per C (source: Guide for the Use of the International System of Units (SI))
fahrenheit_zero_offset = 32 F (source: Guide for the Use of the International System of Units (SI))
rankine_to_fahrenheit_offset = 459.67 R (source: Guide for the Use of the International System of Units (SI))
Sources
Guide for the Use of the International System of Units (SI) (National Institute of Standards and Technology, 2026-09-30T19:29:48Z) - Defining relations: t(K) = t(C) + 273.15; t(F) = (9/5) t(C) + 32; t(R) = (9/5) t(K) = t(F) + 459.67.