Unit Converter Widget
Add an all-in-one unit converter to your website. Readers pick a category, choose the from and to units, and see the answer together with the value in every other unit of that category - using the exact legal definitions of the units.
Live preview
Exactly what your visitors will seeUnder the widget on your page: Powered by A2Z Tools
Embed code
<iframe src="https://a2z.tools/embed/w/unit-converter" title="Unit Converter by A2Z Tools" width="100%" height="670" style="border:0;width:100%" loading="lazy" allow="clipboard-write"></iframe>
A plain iframe. Works everywhere, including site builders that strip scripts. Adjust height if your content needs more room.
<div data-a2z-widget="unit-converter" data-height="670"></div> <script async src="https://a2z.tools/embed.js"></script>
Adds a small script (what it does) that sizes the widget to fit its content, loads it lazily and keeps it isolated from your page's CSS.
Works with
How it works
Every unit is stored as its exact size in the SI base unit of its category, and a conversion multiplies by the source size and divides by the target size - the same approach and factors as the A2Z converter pages. Imperial and US units use their exact definitions (the inch is exactly 2.54 cm, the pound exactly 0.45359237 kg, the US gallon exactly 231 cubic inches). Temperature is converted through kelvin because its scales have different zero points. Data storage lists both decimal (kB, MB, GB) and binary (KiB, MiB, GiB) units and warns when you mix them. Derived units are built from their definitions rather than typed in as rounded numbers: the pound-force is 0.45359237 kg times standard gravity 9.80665 m/s^2, so psi and the foot-pound follow exactly, and mechanical horsepower is 550 foot-pounds per second. The acre is the international acre of 4,046.8564224 m^2, since the US survey foot was retired in 2023. Below the answer a table shows the same value in every unit of the category, and a one-line factor (1 km = 0.6213711922 mi) lets a reader check the arithmetic. Results can be shown to 4, 6, 10 or 15 significant digits; very large or small values switch to exponent form.
Method
- result = value x size(from) / size(to), sizes in the SI base unit
- inch 0.0254 m; foot 0.3048 m; mile 1609.344 m; nautical mile 1852 m
- pound 0.45359237 kg; US gallon 3.785411784 L; imperial gallon 4.54609 L
- atm 101325 Pa; psi 6894.757293 Pa; calorie 4.184 J; BTU (IT) 1055.05585262 J
- Mechanical horsepower = 550 ft.lbf/s = 745.69987 W; metric horsepower (PS) = 735.49875 W
- Temperature: K = C + 273.15; F = C x 9/5 + 32; R = K x 9/5
- Data: kB, MB, GB = 10^3, 10^6, 10^9 bytes; KiB, MiB, GiB = 2^10, 2^20, 2^30 bytes; 1 byte = 8 bits
- acre = 4046.8564224 m^2 (international foot); year = 365.25 d; month = year / 12 = 30.4375 d
- Display: rounded to the chosen significant digits (default 10); exponent form at 1e15 and above or below 1e-4
Worked examples
A 10 km run in miles
Inputs: Category length, 10 km to mi, 10 significant digits
Result: 6.213711922 mi
10 x 1000 / 1609.344 = 6.2137119224; the factor line reads 1 km = 0.6213711922 mi.
Why a 1 TB drive shows about 931 GB
Inputs: Category data, 1 TB to GiB
Result: 931.3225746 GiB, with a warning about decimal and binary units
10^12 / 2^30 = 931.32; operating systems that label GiB as "GB" show the drive as 931 GB.
Two US cups in millilitres
Inputs: Category volume, 2 cup to ml
Result: 473.176473 mL
A US cup is 1/16 of a 231 cubic-inch gallon, 236.5882365 mL; a metric cup (250 mL) is a different unit.
An electric motor rated in kilowatts
Inputs: Category power, 100 kW to hp
Result: 134.102209 hp
100,000 W / 745.69987 W per mechanical horsepower; the same 100 kW is 135.96 metric horsepower (PS).
Limitations
- No currency, fuel economy (L/100 km vs mpg is an inverse, not a factor) or cooking conversions by weight such as cups of flour to grams.
- US survey units, the US dry pint and gallon, and the Australian or metric 250 mL cup are not listed.
- Month and year are calendar averages (365.25-day year), not a particular month or year.
- Input is a plain number; mixed units such as 5 ft 11 in must be converted in two steps.
Where publishers use it
- Science and engineering course pages
- Cooking and baking sites that switch between US cups and millilitres
- Travel blogs converting kilometres, miles, litres and gallons
- Hardware and IT articles explaining why a 1 TB drive shows as 931 GiB
Questions
Why are US and imperial gallons different?
The US gallon is defined as 231 cubic inches (3.785411784 litres); the imperial gallon as exactly 4.54609 litres. Fluid ounces, pints and quarts differ for the same reason, so the converter lists them separately.
How accurate are the conversions?
The factors are the exact definitions (NIST SP 811), not rounded values such as 2.2 lb per kg. Choose 4, 6, 10 or 15 significant digits for the display.
Which horsepower does it use?
Both are listed: mechanical (imperial) horsepower of 745.7 W and metric horsepower (PS) of 735.5 W. Electrical horsepower (746 W) is not included.
Why is a GB different from a GiB?
GB means 1000^3 bytes; GiB means 1024^3 bytes. Drive makers use GB, while many operating systems show GiB, so a 1 TB drive appears as about 931 GiB.
Can I preset a category and units?
Yes, for example v_cat=volume&v_from=cup&v_to=ml&v_value=2. Unit keys are short codes such as km, mi, kg, lb, l, gal, cup, ml, kw and hp; an unknown key falls back to the category's default pair.
Why are there three kinds of ton?
The metric tonne is 1,000 kg, the US short ton 2,000 lb (907.18474 kg) and the UK long ton 2,240 lb (1,016.0469088 kg). Shipping, mining and older British documents use different ones, so the widget lists all three.
What exactly is a knot?
One nautical mile per hour, and the nautical mile is exactly 1,852 metres, so 1 knot = 1.852 km/h = 0.514444 m/s. Aviation and marine forecasts use it.
Sources
- NIST Special Publication 811, Guide for the Use of the International System of Units, Appendix B - NIST . Conversion factors for inch, foot, pound, gallons, psi, mmHg, inHg, BTU (IT), calorie, horsepower
- The International System of Units (SI Brochure) - BIPM . SI base and derived units, prefixes, the kelvin and the degree Celsius, the electronvolt
- U.S. Survey Foot: deprecation from 1 January 2023 - NIST . Why the acre and mile use the international foot (0.3048 m)
- Prefixes for binary multiples - NIST . kibi, mebi, gibi, tebi (2^10 ... 2^40)
- IEC 80000-13:2025 Quantities and units - Part 13: Information science and technology - IEC / ISO . Standard names and symbols for bits, bytes and binary prefixes
Cite or recommend this tool
If you reference this tool in an article, course or documentation, these formats are ready to copy. They are optional - nothing is added to your site unless you paste it.
A2Z Tools Unit Converter https://a2z.tools/embed/unit-converter
<a href="https://a2z.tools/embed/unit-converter">A2Z Tools Unit Converter</a>
[A2Z Tools Unit Converter](https://a2z.tools/embed/unit-converter)
Unit Converter by A2Z Tools - https://a2z.tools/embed/unit-converter
Related widgets
-
Celsius, Fahrenheit, Kelvin and Rankine in one step, with the formulas shown.
-
Binary, octal, decimal, hex and any base from 2 to 36 - exact for very large integers.
-
Convert pixels to rem (and back) for any root font size, with a table of common sizes.
-
X% of Y, X as a percent of Y, and the percentage change between two values.
-
A clean on-screen calculator with keyboard support, correct operator precedence and percent.
-
Trig in degrees or radians, logs, roots, powers, factorials, pi, e and Ans - typed or tapped.