# Unit Converter Convert length / weight / temperature / data-size / time. Pure stdlib. ``` python scripts/run.py 5 km mi python scripts/run.py 180 lb kg python scripts/run.py 100 c f python scripts/run.py 1.5 gb mb python scripts/run.py 2 h s python scripts/run.py --list echo 32 | python scripts/run.py - f c ``` `-p/--precision N` controls decimal places (default 6). --- name: unit-converter display_name: Unit Converter description: "Convert between common units of length, weight, temperature, data size, and time. Use to change km to miles, kg to lb, C to F, GB to MB, hours to seconds. Triggers: convert units, km to miles, celsius to fahrenheit, kg to pounds, gb to mb." --- # Unit Converter Convert between common units across five categories from chat. ## When to use The user wants a quick unit conversion — length, weight, temperature, data size, or time — like km↔miles, kg↔lb, °C↔°F, GB↔MB, or hours↔seconds. ## How to use Run `scripts/run.py` with `value from_unit to_unit`: - `python scripts/run.py 5 km mi` — kilometers to miles. - `python scripts/run.py 180 lb kg` — pounds to kilograms. - `python scripts/run.py 100 c f` — Celsius to Fahrenheit. - `python scripts/run.py 1.5 gb mb` — gigabytes to megabytes. - `python scripts/run.py 2 h s` — hours to seconds. - `python scripts/run.py --list` — show every supported unit. - `echo 32 | python scripts/run.py - f c` — read the value from stdin. Use `-p/--precision` to set decimal places (default 6). ## Pitfalls - Units must be in the same category; mixing (e.g. `kg` to `m`) exits 1. - Data sizes: `kb/mb/gb` are decimal (1000), `kib/mib/gib` are binary (1024); `b`/`bit` are bits, `B`/`byte` are bytes. - Temperature uses single letters `c`, `f`, `k` (or full names).
Unit Converter by langbot-team
Convert between common units of length, weight, temperature, data size, and time.
Loading...