# Unit converter

Convert between units of length, mass, temperature, area, volume, speed, time, data, pressure, energy and more.

- Endpoint: `POST https://setget.net/v1/tools/unit-convert` with JSON `{"input": {...}}`
- MCP: `run_tool` with `slug` = `unit-convert`
- Page: https://setget.net/tools/unit-convert

## Inputs

- `value` (required, number, range -1e+30..1e+30): The amount to convert.
- `from_unit` (required, string): Unit to convert from, as a symbol or name.
- `to_unit` (required, string): Unit to convert to, as a symbol or name.

## Example 1

```json
{"input":{"value":10,"from_unit":"km","to_unit":"miles"}}
```

Result:

```json
{"value":6.21371192237,"text":"10 km = 6.21371192237 mi","from":{"unit":"kilometre","symbol":"km","kind":"length"},"to":{"unit":"mile","symbol":"mi","kind":"length"},"factor":0.621371192237,"formula":"1 km = 0.621371192237 mi","note":null}
```

## Example 2: Temperature

```json
{"input":{"value":100,"from_unit":"C","to_unit":"F"}}
```

Result:

```json
{"value":212,"text":"100 °C = 212 °F","from":{"unit":"degree Celsius","symbol":"°C","kind":"temperature"},"to":{"unit":"degree Fahrenheit","symbol":"°F","kind":"temperature"},"factor":null,"formula":"°F = °C * 9 / 5 + 32","note":null}
```

## Example 3: Binary and decimal data units

```json
{"input":{"value":1,"from_unit":"GiB","to_unit":"MB"}}
```

Result:

```json
{"value":1073.741824,"text":"1 GiB = 1073.741824 MB","from":{"unit":"gibibyte","symbol":"GiB","kind":"data"},"to":{"unit":"megabyte","symbol":"MB","kind":"data"},"factor":1073.741824,"formula":"1 GiB = 1073.741824 MB","note":null}
```

**What is the difference between MB and MiB?** MB is 1,000,000 bytes (decimal, used for disk sizes and network speeds). MiB is 1,048,576 bytes (binary, used for memory). The same goes for kB and KiB, GB and GiB.

**Is a gallon the US or the UK one?** "gal", "pint", "fl oz", "ton" and "mpg" are read as the US measures and a note says so. Use gal_uk, pt_uk, floz_uk, "long ton" and mpg_uk for the imperial ones.

**How long are a month and a year?** The average Gregorian lengths: a year is 365.2425 days and a month is one twelfth of that. For real calendar dates use date-add.

**How precise are the results?** Conversions use exact definitions and results are rounded to 12 significant digits.
