Skip to main content
The Unit Converter supports four categories of conversions with precise mathematical formulas implemented in the backend server.

Temperature Conversions

Convert between three temperature scales commonly used in science and daily life.

Supported Units

Celsius (°C)

Metric standard, water freezes at 0°C

Fahrenheit (°F)

US customary, water freezes at 32°F

Kelvin (K)

Absolute scale, zero is absolute zero

Conversion Formulas

The backend uses a base conversion strategy where all temperatures are first converted to Celsius, then to the target unit:
From Fahrenheit:
celsius = (fahrenheit - 32) * 5 / 9
From Kelvin:
celsius = kelvin - 273.15
From server.py:34-39

Examples

InputOutputUse Case
0°C32°FFreezing point of water
100°C212°FBoiling point of water
37°C98.6°FHuman body temperature
-40°C-40°FTemperature scales intersect
0 K-273.15°CAbsolute zero

Length Conversions

Convert between metric and imperial length measurements.

Supported Units

m (Meters)

Base SI unit for length

km (Kilometers)

1 km = 1000 meters

mi (Miles)

US/UK imperial mile

ft (Feet)

US customary unit

Conversion Formulas

All lengths are converted to meters as the base unit, then to the target:
# Conversion factors to meters
a_metros = {
    "m": 1.0,
    "km": 1000.0,
    "mi": 1609.344,
    "ft": 0.3048
}

# Two-step conversion: source → meters → target
result = valor * a_metros[desde] / a_metros[hasta]
From server.py:58-61

Precise Conversion Factors

UnitMeters Equivalent
1 meter (m)1.0 m
1 kilometer (km)1,000 m
1 mile (mi)1,609.344 m
1 foot (ft)0.3048 m

Examples

InputOutputUse Case
1 km0.621371 miDistance conversion
1 mi5,280 ftMile to feet
100 m328.084 ftTrack and field
1 ft0.3048 mConstruction measurements

Weight Conversions

Convert between metric and imperial weight/mass measurements.

Supported Units

kg (Kilograms)

Base SI unit for mass

lb (Pounds)

US customary weight unit

g (Grams)

1 g = 0.001 kg

Conversion Formulas

All weights are converted to kilograms as the base unit, then to the target:
# Conversion factors to kilograms
a_kg = {
    "kg": 1.0,
    "lb": 0.453592,
    "g": 0.001
}

# Two-step conversion: source → kg → target
result = valor * a_kg[desde] / a_kg[hasta]
From server.py:74-77

Precise Conversion Factors

UnitKilograms Equivalent
1 kilogram (kg)1.0 kg
1 pound (lb)0.453592 kg
1 gram (g)0.001 kg

Examples

InputOutputUse Case
1 kg2.20462 lbWeight conversion
1 lb453.592 gCooking measurements
1000 g1 kgMetric system
150 lb68.0389 kgBody weight

Velocity Conversions

Convert between different speed measurement systems.

Supported Units

km/h

Kilometers per hour (metric)

mph

Miles per hour (imperial)

m/s

Meters per second (SI base)

Conversion Formulas

All velocities are converted to meters per second (m/s) as the base unit, then to the target:
# Conversion factors to meters per second
a_ms = {
    "ms": 1.0,
    "kmh": 1/3.6,      # 1 km/h = 0.277778 m/s
    "mph": 0.44704
}

# Two-step conversion: source → m/s → target
result = valor * a_ms[desde] / a_ms[hasta]
From server.py:90-93

Precise Conversion Factors

UnitMeters/Second Equivalent
1 m/s1.0 m/s
1 km/h0.277778 m/s (1/3.6)
1 mph0.44704 m/s

Examples

InputOutputUse Case
100 km/h62.1371 mphHighway speed limits
60 mph96.5606 km/hSpeed limit conversion
10 m/s36 km/hPhysics problems
100 km/h27.7778 m/sScientific calculations

Implementation Details

Backend Architecture

All conversions are performed by the ICE backend server (server.py) which implements the ConversorUnidades interface:
class ConversorUnidadesImpl(Conversor.ConversorUnidades):
    def convertirTemperatura(self, valor, desde, hasta, current=None):
        # Temperature conversion logic
    
    def convertirLongitud(self, valor, desde, hasta, current=None):
        # Length conversion logic
    
    def convertirPeso(self, valor, desde, hasta, current=None):
        # Weight conversion logic
    
    def convertirVelocidad(self, valor, desde, hasta, current=None):
        # Velocity conversion logic
From server.py:14-93

Unit Validation

The server validates all units before performing conversions:
def _validar(self, desde, hasta, validas, categoria):
    errores = []
    if desde not in validas:
        errores.append(f"Unidad origen '{desde}' no valida para {categoria}.")
    if hasta not in validas:
        errores.append(f"Unidad destino '{hasta}' no valida para {categoria}.")
    if errores:
        ex = Conversor.UnidadInvalidaException()
        ex.mensaje = " ".join(errores) + f" Validas: {', '.join(sorted(validas))}"
        raise ex
From server.py:114-128

Precision and Rounding

The backend performs calculations using Python’s native float type with full precision. The frontend rounds results to 6 decimal places for display purposes (app.js:129).
const formatted = parseFloat(res.toFixed(6)).toString();

Available Units Query

The server provides a method to query available units for any category:
def unidadesDisponibles(self, categoria, current=None):
    catalogo = {
        "temperatura": "celsius, fahrenheit, kelvin",
        "longitud":    "m, km, mi, ft",
        "peso":        "kg, lb, g",
        "velocidad":   "kmh, mph, ms",
    }
    return catalogo[categoria.lower()]
From server.py:95-112
All unit names are case-insensitive. The server converts them to lowercase before processing.

Build docs developers (and LLMs) love