Celsius to Fahrenheit to Kelvin: the correct formulae

Temperature is not a simple scale factor. Zero on one scale is not zero on another — so “just multiply by 1.8” without the ±32 (or Kelvin offset) is wrong.

The three scales

Point°C°FK
Absolute zero−273.15−459.670
Water freezes (std)032273.15
Water boils (std)100212373.15
Body-ish3798.6310.15

Formulae that work

K  = C + 273.15
C  = K - 273.15
F  = C * 9/5 + 32
C  = (F - 32) * 5/9
F  = K * 9/5 - 459.67
K  = (F + 459.67) * 5/9

Implement via Kelvin as a hub if you support many scales — one place for absolute-zero checks.

The classic bug

// Wrong: treats 0 °C like 0 °F
f = c * 1.8;          // 0 → 0 (should be 32); 100 → 180 (should be 212)

// Right
f = c * 1.8 + 32;

Unit tests with 0 °C → 32 °F and 100 °C → 212 °F catch this immediately. Also test a negative: −40 °C = −40 °F (the scales cross).

API check

curl -s 'https://api.oddlathe.com/v1/units?value=20&from=C&to=F'
# → roughly 68

curl -s 'https://api.oddlathe.com/v1/units?value=-300&from=C&to=K'
# → error: below absolute zero

Live docs: /docs/units. Length/mass/data sizes live on the same endpoint.

Sensor and weather gotchas

Related

Unit converter · KB vs KiB / MB vs MiB · Metric tonne vs ton · Unix seconds vs milliseconds · Anvil /v1/units · Anvil date/diff

Questions

What is the Celsius to Fahrenheit formula?

°F = °C × 9/5 + 32. The +32 is required; multiplying alone is wrong.

How do I convert Fahrenheit to Celsius?

°C = (°F − 32) × 5/9.

How do I convert Celsius to Kelvin?

K = °C + 273.15. Kelvin has no degree sign in modern SI writing.

Why did my converter say 0 °C is 0 °F?

It skipped the offset. 0 °C is 32 °F.

Can temperature be below 0 K?

No. Physical absolute zero is 0 K (−273.15 °C). A correct API rejects values below that.

Is a 5 °C rise the same as a 5 K rise?

Yes for differences. A 5 °C rise is a 9 °F rise, not 5 °F.

Published .

Try it

Related guides

Newest guides