Percentage calculator

Work out percentages: X% of Y, what percent X is of Y, percent change, and increase or decrease by X%.

Input

What to work out: percent_of (X% of Y), what_percent (X is what % of Y), change (from X to Y), increase (Y plus X%) or decrease (Y minus X%).
X: the percentage, or the first value, depending on the mode.
Y: the amount the percentage applies to, or the second value.

Result

Fill in the input and press Run.

Your input is processed in memory and then discarded. It is not stored or logged. Even so, don't paste live passwords or keys into any online tool.

Use it from code or an agent

curl -s https://setget.net/v1/tools/percent \
  -H 'Content-Type: application/json' \
  -d '{"input":{"mode":"percent_of","x":15,"y":80}}'
import json, urllib.request

body = {'input': {'mode': 'percent_of', 'x': 15, 'y': 80}}
request = urllib.request.Request("https://setget.net/v1/tools/percent", json.dumps(body).encode(),
                                 {"Content-Type": "application/json"})
print(json.load(urllib.request.urlopen(request))["result"])
const response = await fetch("https://setget.net/v1/tools/percent", {
  method: "POST",
  headers: {"Content-Type": "application/json"},
  body: JSON.stringify({"input":{"mode":"percent_of","x":15,"y":80}}),
});
console.log((await response.json()).result);
Tool: run_tool
Arguments:
{
  "slug": "percent",
  "input": {
    "mode": "percent_of",
    "x": 15,
    "y": 80
  }
}
{
  "input": {
    "mode": "percent_of",
    "x": 15,
    "y": 80
  }
}

Endpoint: POST /v1/tools/percent. Over MCP: run_tool with slug: "percent". Machine-readable: input schema, Markdown. Connect an agent.

Inputs

NameTypeRequiredWhat it does
mode string yes What to work out: percent_of (X% of Y), what_percent (X is what % of Y), change (from X to Y), increase (Y plus X%) or decrease (Y minus X%). One of: percent_of, what_percent, change, increase, decrease.
x number yes X: the percentage, or the first value, depending on the mode. From -1000000000000000.0 to 1000000000000000.0.
y number yes Y: the amount the percentage applies to, or the second value. From -1000000000000000.0 to 1000000000000000.0.

Examples

Input
{
  "mode": "percent_of",
  "x": 15,
  "y": 80
}
Result
{
  "result": 12,
  "formula": "80 * 15 / 100 = 12",
  "text": "15% of 80 is 12"
}

Percent change

Input
{
  "mode": "change",
  "x": 80,
  "y": 100
}
Result
{
  "result": 25,
  "formula": "(100 - 80) / 80 * 100 = 25",
  "text": "From 80 to 100 is an increase of 25%"
}

What percent

Input
{
  "mode": "what_percent",
  "x": 30,
  "y": 120
}
Result
{
  "result": 25,
  "formula": "30 / 120 * 100 = 25",
  "text": "30 is 25% of 120"
}

Questions

Why is a rise from 80 to 100 25%, but a fall from 100 to 80 only 20%?
Percent change is measured against the starting value. 20 is a quarter of 80 but only a fifth of 100.
How do I take 20% off a price?
Use mode "decrease" with x = 20 and y = the price.