Unit Converter
Convert between different measurement units. Supports length, weight, temperature, area, volume, speed, time, and data units.
When to Use
- Convert between metric and imperial units
- Calculate unit equivalencies
- Work with different measurement systems
- Convert digital storage sizes
Quick Start
Basic Conversions
python3 scripts/unit-convert.py 100 cm m
# Output: 100 cm = 1 m
python3 scripts/unit-convert.py 10 kg lb
# Output: 10 kg = 22.05 lb
python3 scripts/unit-convert.py 25 C F
# Output: 25 C = 77 F
List Units
python3 scripts/unit-convert.py list length
# Shows all length units
Show Categories
python3 scripts/unit-convert.py categories
Commands
<value> <from_unit> <to_unit>
Convert between units.
Examples:
# Length
python3 scripts/unit-convert.py 100 cm m
python3 scripts/unit-convert.py 5 ft cm
python3 scripts/unit-convert.py 1 mi km
# Weight
python3 scripts/unit-convert.py 10 kg lb
python3 scripts/unit-convert.py 1000 g kg
python3 scripts/unit-convert.py 16 oz lb
# Temperature
python3 scripts/unit-convert.py 25 C F
python3 scripts/unit-convert.py 98.6 F C
python3 scripts/unit-convert.py 300 K C
# Area
python3 scripts/unit-convert.py 100 m2 ft2
python3 scripts/unit-convert.py 1 acre m2
# Volume
python3 scripts/unit-convert.py 1000 ml l
python3 scripts/unit-convert.py 1 gal l
# Speed
python3 scripts/unit-convert.py 100 km/h mph
python3 scripts/unit-convert.py 10 m/s km/h
# Time
python3 scripts/unit-convert.py 3600 s h
python3 scripts/unit-convert.py 7 day h
# Data
python3 scripts/unit-convert.py 1024 B KB
python3 scripts/unit-convert.py 1 GB MB
list <category>
List all units in a category.
Examples:
python3 scripts/unit-convert.py list length
python3 scripts/unit-convert.py list weight
python3 scripts/unit-convert.py list temperature
categories
Show all supported categories.
python3 scripts/unit-convert.py categories
help <category>
Show help for a specific category.
python3 scripts/unit-convert.py help temperature
python3 scripts/unit-convert.py help length
Supported Categories
Length
- Metric: mm, cm, m, km
- Imperial: in, ft, yd, mi, inch, foot, yard, mile
Weight
- Metric: mg, g, kg, t (tonne)
- Imperial: oz, lb, stone, ounce, pound
Temperature
- C - Celsius
- F - Fahrenheit
- K - Kelvin
Area
- Metric: mm², cm², m², km²
- Imperial: in², ft², yd², acre, mi²
Volume
- Metric: ml, l, kl
- Imperial: fl oz, cup, pt, qt, gal
Speed
- Metric: m/s, km/h
- Imperial: ft/s, mph
- Nautical: knot
Time
- Short: ms, s, min
- Long: h, day, week, year
Data
- Binary: B, KB, MB, GB, TB, PB
- (Uses 1024-based conversion)
Unit Aliases
The converter accepts common aliases:
| Standard |
Aliases |
| in |
inch, inches |
| ft |
foot, feet |
| yd |
yard, yards |
| mi |
mile, miles |
| oz |
ounce, ounces |
| lb |
pound, pounds |
| pt |
pint, pints |
| qt |
quart, quarts |
| gal |
gallon, gallons |
| ml |
milliliter, milliliters |
| l |
liter, liters |
| kl |
kiloliter, kiloliters |
| h |
hour, hours |
| min |
minute, minutes |
| s |
second, seconds |
| ms |
millisecond, milliseconds |
Examples
Everyday Conversions
# Height conversions
python3 scripts/unit-convert.py 180 cm ft
python3 scripts/unit-convert.py 6 ft cm
# Weight conversions
python3 scripts/unit-convert.py 70 kg lb
python3 scripts/unit-convert.py 150 lb kg
# Temperature
python3 scripts/unit-convert.py 32 F C
python3 scripts/unit-convert.py 100 C F
# Area (room size)
python3 scripts/unit-convert.py 100 m2 ft2
python3 scripts/unit-convert.py 1000 ft2 m2
Cooking & Recipes
# Volume conversions
python3 scripts/unit-convert.py 1 cup ml
python3 scripts/unit-convert.py 250 ml cup
python3 scripts/unit-convert.py 1 gal l
# Weight conversions
python3 scripts/unit-convert.py 500 g lb
python3 scripts/unit-convert.py 1 lb g
Travel & Distance
# Distance
python3 scripts/unit-convert.py 100 km mi
python3 scripts/unit-convert.py 50 mi km
# Speed limits
python3 scripts/unit-convert.py 60 mph km/h
python3 scripts/unit-convert.py 100 km/h mph
Digital Storage
# File sizes
python3 scripts/unit-convert.py 1 GB MB
python3 scripts/unit-convert.py 1024 KB MB
python3 scripts/unit-convert.py 1 TB GB
Science & Engineering
# Precise measurements
python3 scripts/unit-convert.py 25.4 mm in
python3 scripts/unit-convert.py 1000 mg g
# Time calculations
python3 scripts/unit-convert.py 365 day h
python3 scripts/unit-convert.py 86400 s day
Tips
- Use the
list command to see all available units for a category
- Temperature units are case-sensitive (C, F, K)
- For compound units like m/s, use the slash notation
- The converter handles both short and long unit names
- Results are formatted for readability
Troubleshooting
"Cannot convert" error:
- Check unit spelling
- Ensure units are from the same category (e.g., don't convert length to weight)
- Use
list command to see available units
Unexpected results:
- Temperature conversions use standard formulas
- Data conversions use 1024-based (binary) units
- Double-check unit case sensitivity
Notes
- Temperature conversions use standard formulas
- Data conversions use binary (1024-based) units
- All other conversions use decimal (1000-based) units
- Results are automatically formatted for readability
1---
2name: unit-convert
3description: "Comprehensive unit converter for length, weight, temperature, area, volume, speed, time, and data. Use when: (1) converting between measurement units, (2) calculating unit equivalencies, (3) working with different measurement systems, or (4) any unit conversion needs. Supports metric, imperial, and digital units."
4metadata:
5 source: https://skillmd.com/skills/modbender/unit-convert
6---
7
8# Unit Converter
9
10Convert between different measurement units. Supports length, weight, temperature, area, volume, speed, time, and data units.
11
12## When to Use
13
14- Convert between metric and imperial units
15- Calculate unit equivalencies
16- Work with different measurement systems
17- Convert digital storage sizes
18
19## Quick Start
20
21### Basic Conversions
22```bash
23python3 scripts/unit-convert.py 100 cm m
24# Output: 100 cm = 1 m
25
26python3 scripts/unit-convert.py 10 kg lb
27# Output: 10 kg = 22.05 lb
28
29python3 scripts/unit-convert.py 25 C F
30# Output: 25 C = 77 F
31```
32
33### List Units
34```bash
35python3 scripts/unit-convert.py list length
36# Shows all length units
37```
38
39### Show Categories
40```bash
41python3 scripts/unit-convert.py categories
42```
43
44## Commands
45
46### `<value> <from_unit> <to_unit>`
47Convert between units.
48
49**Examples:**
50```bash
51# Length
52python3 scripts/unit-convert.py 100 cm m
53python3 scripts/unit-convert.py 5 ft cm
54python3 scripts/unit-convert.py 1 mi km
55
56# Weight
57python3 scripts/unit-convert.py 10 kg lb
58python3 scripts/unit-convert.py 1000 g kg
59python3 scripts/unit-convert.py 16 oz lb
60
61# Temperature
62python3 scripts/unit-convert.py 25 C F
63python3 scripts/unit-convert.py 98.6 F C
64python3 scripts/unit-convert.py 300 K C
65
66# Area
67python3 scripts/unit-convert.py 100 m2 ft2
68python3 scripts/unit-convert.py 1 acre m2
69
70# Volume
71python3 scripts/unit-convert.py 1000 ml l
72python3 scripts/unit-convert.py 1 gal l
73
74# Speed
75python3 scripts/unit-convert.py 100 km/h mph
76python3 scripts/unit-convert.py 10 m/s km/h
77
78# Time
79python3 scripts/unit-convert.py 3600 s h
80python3 scripts/unit-convert.py 7 day h
81
82# Data
83python3 scripts/unit-convert.py 1024 B KB
84python3 scripts/unit-convert.py 1 GB MB
85```
86
87### `list <category>`
88List all units in a category.
89
90**Examples:**
91```bash
92python3 scripts/unit-convert.py list length
93python3 scripts/unit-convert.py list weight
94python3 scripts/unit-convert.py list temperature
95```
96
97### `categories`
98Show all supported categories.
99
100```bash
101python3 scripts/unit-convert.py categories
102```
103
104### `help <category>`
105Show help for a specific category.
106
107```bash
108python3 scripts/unit-convert.py help temperature
109python3 scripts/unit-convert.py help length
110```
111
112## Supported Categories
113
114### Length
115- **Metric**: mm, cm, m, km
116- **Imperial**: in, ft, yd, mi, inch, foot, yard, mile
117
118### Weight
119- **Metric**: mg, g, kg, t (tonne)
120- **Imperial**: oz, lb, stone, ounce, pound
121
122### Temperature
123- **C** - Celsius
124- **F** - Fahrenheit
125- **K** - Kelvin
126
127### Area
128- **Metric**: mm², cm², m², km²
129- **Imperial**: in², ft², yd², acre, mi²
130
131### Volume
132- **Metric**: ml, l, kl
133- **Imperial**: fl oz, cup, pt, qt, gal
134
135### Speed
136- **Metric**: m/s, km/h
137- **Imperial**: ft/s, mph
138- **Nautical**: knot
139
140### Time
141- **Short**: ms, s, min
142- **Long**: h, day, week, year
143
144### Data
145- **Binary**: B, KB, MB, GB, TB, PB
146- (Uses 1024-based conversion)
147
148## Unit Aliases
149
150The converter accepts common aliases:
151
152| Standard | Aliases |
153|----------|---------|
154| in | inch, inches |
155| ft | foot, feet |
156| yd | yard, yards |
157| mi | mile, miles |
158| oz | ounce, ounces |
159| lb | pound, pounds |
160| pt | pint, pints |
161| qt | quart, quarts |
162| gal | gallon, gallons |
163| ml | milliliter, milliliters |
164| l | liter, liters |
165| kl | kiloliter, kiloliters |
166| h | hour, hours |
167| min | minute, minutes |
168| s | second, seconds |
169| ms | millisecond, milliseconds |
170
171## Examples
172
173### Everyday Conversions
174```bash
175# Height conversions
176python3 scripts/unit-convert.py 180 cm ft
177python3 scripts/unit-convert.py 6 ft cm
178
179# Weight conversions
180python3 scripts/unit-convert.py 70 kg lb
181python3 scripts/unit-convert.py 150 lb kg
182
183# Temperature
184python3 scripts/unit-convert.py 32 F C
185python3 scripts/unit-convert.py 100 C F
186
187# Area (room size)
188python3 scripts/unit-convert.py 100 m2 ft2
189python3 scripts/unit-convert.py 1000 ft2 m2
190```
191
192### Cooking & Recipes
193```bash
194# Volume conversions
195python3 scripts/unit-convert.py 1 cup ml
196python3 scripts/unit-convert.py 250 ml cup
197python3 scripts/unit-convert.py 1 gal l
198
199# Weight conversions
200python3 scripts/unit-convert.py 500 g lb
201python3 scripts/unit-convert.py 1 lb g
202```
203
204### Travel & Distance
205```bash
206# Distance
207python3 scripts/unit-convert.py 100 km mi
208python3 scripts/unit-convert.py 50 mi km
209
210# Speed limits
211python3 scripts/unit-convert.py 60 mph km/h
212python3 scripts/unit-convert.py 100 km/h mph
213```
214
215### Digital Storage
216```bash
217# File sizes
218python3 scripts/unit-convert.py 1 GB MB
219python3 scripts/unit-convert.py 1024 KB MB
220python3 scripts/unit-convert.py 1 TB GB
221```
222
223### Science & Engineering
224```bash
225# Precise measurements
226python3 scripts/unit-convert.py 25.4 mm in
227python3 scripts/unit-convert.py 1000 mg g
228
229# Time calculations
230python3 scripts/unit-convert.py 365 day h
231python3 scripts/unit-convert.py 86400 s day
232```
233
234## Tips
235
236- Use the `list` command to see all available units for a category
237- Temperature units are case-sensitive (C, F, K)
238- For compound units like m/s, use the slash notation
239- The converter handles both short and long unit names
240- Results are formatted for readability
241
242## Troubleshooting
243
244**"Cannot convert" error:**
245- Check unit spelling
246- Ensure units are from the same category (e.g., don't convert length to weight)
247- Use `list` command to see available units
248
249**Unexpected results:**
250- Temperature conversions use standard formulas
251- Data conversions use 1024-based (binary) units
252- Double-check unit case sensitivity
253
254## Notes
255
256- Temperature conversions use standard formulas
257- Data conversions use binary (1024-based) units
258- All other conversions use decimal (1000-based) units
259- Results are automatically formatted for readability