Skip to content
PithLab

↑↓ to move · Enter to open · Esc to close

Ratio Calculator API

Simplify a ratio (4:6 → 2:3, with percentages), solve a proportion A:B = C:D for the missing value, or split an amount in a ratio.

POST /api/v1/tools/ratio-calculatorMCP ratio_calculatorCalculators

Simplify ratios (decimals too), solve A:B = C:? for a missing value, split an amount in a given ratio, and convert a ratio to percentages.

Input

Send these as a JSON object. Unknown fields are rejected.

mode
simplify: reduce ratio. solve: find the blank in A:B = C:D. split: divide total in ratio. (string, one of simplify, solve, split, default "simplify")
ratio
simplify and split: the ratio with 2 to 10 non-negative terms, e.g. "4:6", "2:3:5", "1.5 to 2". (string, up to 400 characters)
total
split: the amount to divide. (number)
a
solve: A in A:B = C:D. Exactly one of a, b, c, d must be "?" (or omitted). (string, up to 40 characters)
b
solve: B in A:B = C:D. (string, up to 40 characters)
c
solve: C in A:B = C:D. (string, up to 40 characters)
d
solve: D in A:B = C:D. (string, up to 40 characters)
curl https://pithlab.com/api/v1/tools/ratio-calculator \n  -H "Authorization: Bearer $PITHLAB_KEY" \n  -H "Content-Type: application/json" \n  -d '{"mode":"split","ratio":"2:3:5","total":1000}'
Example response
{
  "ok": true,
  "result": {
    "parts": [
      200,
      300,
      500
    ],
    "percentages": [
      "20%",
      "30%",
      "50%"
    ],
    "text": "1,000 split 2 : 3 : 5 is 200, 300 and 500"
  }
}