## Unit Converters

version 1.24.0.0 (577 KB) by
Convert units of pressure, length, time, force, mass, accel., temp, speed, frequency, area, & more!

Updated 6 Aug 2014

Editor's Note: This file was selected as MATLAB Central Pick of the Week

Intuitive functions for conversion of acceleration, angle, area, computing, force, frequency, energy, length, mass, power, pressure, speed, temperature, time, or volume. All converters in this bundle take the form from2to().
EXAMPLE: Convert 700 kilopascals to pounds per square inch:

kPa2psi(700)

ans =

101.5264

Supported units and their abbreviations:

ACCELERATION:
centimeters per second squared (cmps2)
Earth gravities (G)
feet per second squared (ftps2)
galileos (Gal)
microgalileos (uGal)
milligalileos (mGal)
meters per second squared (mps2)
millimeters per second squared (mmps2)
nanometers per second squared (nmps2)

ANGLE:
degrees (deg)

AREA:
acres (acre)
hectares (ha)
square centimeters (cm2)
square feet (ft2)
square inches (in2)
square kilometers (km2)
square meters (m2)
square miles (mi2)
square millimeters (mm2)
square yards (yd2)

COMPUTING:
bits (bit)
bytes (B)
exabytes (EB)
gigabytes (GB)
kilobytes (KB)
megabytes (MB)
petabytes (PB)
terabytes (TB)

ENERGY AND WORK:
British thermal units (Btu)
calories (cal)
electron volts (eV)
ergs (erg)
foot-pounds (ftlb)
joules (J)
kilocalories or nutritional calories (kcal)
kilojoules (kJ)
kilowatt-hours (kWh)
newton-meters (Nm)

FORCE:
dynes (dyn)
kilopounds (kip)
kilonewtons (kN)
pounds (lbf)
newtons (N)
ounces-force (ozf)

FREQUENCY:
gigahertz (GHz)
hertz (Hz)
kilohertz (kHz)
megahertz (MHz)
revolutions per minute (rpm)
terahertz (THz)

LENGTH:
angstroms (A)
astronomical units (au)
centimeters (cm)
decimeters (dm)
feet (ft)
inches (in)
kilometers (km)
light years (ly)
meters (m)
micrometers or microns (um)
miles (mi)
millimeters (mm)
nautical miles (nautmi)
nanometers (nm)
picometers (pm)
yards (yd)

MASS:
atomic mass units (amu)
grams (g)
kilograms (kg)
pounds-mass (lbm)
microgram (ug)
milligrams (mg)
slugs (slug)

POWER:
boiler horsepower (hpb)
British thermal units per hour (Btuph)
electrical horsepower (hpe)
gigawatts (GW)
kilowatts (kW)
mechanical horsepower (hp)
megawatts (MW)
terawatts (TW)
watts (W)

PRESSURE:
standard atmospheres (atm)
bar (bar)
dynes per square centimeter (dynpcm2)
feet of water column at 4°C (ftH2O)
hectopascals (hPa)
inches of water column at 4°C (inH2O)
megapascals (MPa)
kilopascals (kPa)
millibar (mbar)
millimeters of mercury at 0°C (mmHg)
pascals (Pa)
pounds per square inch (psi)
torr (Torr)

SPEED:
feet per second (ftps)
kilometers per hour (kmph)
knots (knot)
mach number at STP (mach)
miles per hour (mph)
meters per second (mps)

TEMPERATURE:
celsius (C)
fahrenheit (F)
kelvin (K)
rankine (R)

TIME:
days (day)
hours (hr)
microseconds (us)
minutes (min)
milliseconds (ms)
nanoseconds (ns)
seconds (s)
years (yr)

VOLUME:
centiliters (cl)
cubic centimeters (cc or cm3)
cubic feet (ft3)
cubic inches (in3)
cubic kilometers (km3)
cubic meters (m3)
cubic miles (mi3)
cubic yards (yd3)
liters (l)
milliliters (ml)
US liquid gallons (gal)
US liquid ounces (oz)
US liquid quarts (qt)

Convert units, organize your code, and a year from now when you look over your old scripts, instantly recognize what units are associated with variables, before and after conversion. Other converters are available (acknowledged below), but the functions in this bundle were designed to be simpler, more comprehensive, and more intuitive. Please alert me if you find any errors.

### Cite As

Chad Greene (2022). Unit Converters (https://www.mathworks.com/matlabcentral/fileexchange/35258-unit-converters), MATLAB Central File Exchange. Retrieved .

##### MATLAB Release Compatibility
Created with R2010a
Compatible with any release
##### Platform Compatibility
Windows macOS Linux