convert

March 28, 2026 ยท View on GitHub

Convert values between units of measurement. Automatically detects the category from the unit names.

Usage

openGyver convert <value> <from-unit> <to-unit> [flags]

Flags

FlagShortTypeDefaultDescription
--abbreviated-aboolfalseOutput only the converted value and unit (omit the input side)
--json-jboolfalseOutput as JSON
--help-hboolfalseShow help for convert

Arguments

ArgumentRequiredDescription
valueYesNumeric value to convert
from-unitYesSource unit (case-insensitive, short or long form)
to-unitYesTarget unit (case-insensitive, short or long form)

Supported Categories and Units

Temperature

UnitAliases
Celsiusc, celsius
Fahrenheitf, fahrenheit
Kelvink, kelvin

Length

UnitAliases
Millimetermm
Centimetercm
Meterm
Kilometerkm
Inchin
Footft
Yardyd
Milemi
Nautical Milenm

Weight

UnitAliases
Milligrammg
Gramg
Kilogramkg
Ounceoz
Poundlb
Ton (US)ton
Tonne (metric)tonne
Stonest

Volume

UnitAliases
Milliliterml
Literl
Gallongal
Quartqt
Pintpt
Cupcup
Fluid Ouncefloz
Tablespoontbsp
Teaspoontsp

Area

UnitAliases
Square Millimetersqmm
Square Centimetersqcm
Square Metersqm
Square Kilometersqkm
Square Inchsqin
Square Footsqft
Square Yardsqyd
Square Milesqmi
Acreacre
Hectarehectare

Speed

UnitAliases
Meters/secondmps
Kilometers/hourkph
Miles/hourmph
Knotsknots
Feet/secondfps

Data

UnitAliases
Byteb
Kilobytekb
Megabytemb
Gigabytegb
Terabytetb
Petabytepb
Bitbit
Kilobitkbit
Megabitmbit
Gigabitgbit

Time

UnitAliases
Millisecondms
Secondsec
Minutemin
Hourhr
Dayday
Weekweek
Monthmonth
Yearyear

Currency

Live rates via the Frankfurter API (no API key needed).

Supported currencies: usd, eur, gbp, jpy, cad, aud, chf, cny, inr, mxn, brl, krw, sgd, hkd, nok, sek, dkk, nzd, zar, rub, try, pln, thb, idr, huf, czk, ils, clp, php, aed, cop, sar, myr, ron, bgn, hrk, isk, twd.

Examples

# Length conversion
openGyver convert 100 cm in

# Temperature conversion
openGyver convert 72 f c

# Data size conversion
openGyver convert 1.5 gb mb

# Time duration conversion
openGyver convert 365 days hours

# Speed conversion
openGyver convert 60 mph kph

# Area conversion
openGyver convert 2.5 acre sqft

# Volume conversion
openGyver convert 500 ml cup

# Weight conversion
openGyver convert 150 lb kg

# Currency conversion (live rates)
openGyver convert 100 usd eur

# Abbreviated output (value and unit only)
openGyver convert 100 cm in -a

# JSON output for scripting
openGyver convert 72 f c -j

# Pipe abbreviated output to another command
openGyver convert 100 usd eur -a | cut -d' ' -f1

# Large data conversion
openGyver convert 1 pb gb

# Nautical miles to kilometers
openGyver convert 10 nm km

JSON Output Format

{
  "input_value": 72,
  "input_unit": "Fahrenheit",
  "output_value": 22.222222,
  "output_unit": "Celsius",
  "category": "Temperature"
}

Notes

  • Unit names are case-insensitive. Both short and long forms work (e.g., cm or centimeter).
  • The category is automatically detected from the unit names; you do not need to specify it.
  • Cross-category conversions (e.g., cm to kg) produce an error.
  • Currency conversion requires an internet connection for live exchange rates.