Fraction and decimal converter

Convert a decimal to a fraction or a fraction to a decimal, simplify a/b, and show mixed numbers.

Input

A decimal (0.75), a fraction (6/8), a mixed number (1 3/4) or a repeating decimal (0.1(6)).
Largest denominator allowed. The closest fraction within it is returned.

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/fraction \
  -H 'Content-Type: application/json' \
  -d '{"input":{"value":"0.75"}}'
import json, urllib.request

body = {'input': {'value': '0.75'}}
request = urllib.request.Request("https://setget.net/v1/tools/fraction", 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/fraction", {
  method: "POST",
  headers: {"Content-Type": "application/json"},
  body: JSON.stringify({"input":{"value":"0.75"}}),
});
console.log((await response.json()).result);
Tool: run_tool
Arguments:
{
  "slug": "fraction",
  "input": {
    "value": "0.75"
  }
}
{
  "input": {
    "value": "0.75"
  }
}

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

Inputs

NameTypeRequiredWhat it does
value string yes A decimal (0.75), a fraction (6/8), a mixed number (1 3/4) or a repeating decimal (0.1(6)).
max_denominator integer no Largest denominator allowed. The closest fraction within it is returned. From 1 to 1000000000.

Examples

Input
{
  "value": "0.75"
}
Result
{
  "fraction": "3/4",
  "numerator": 3,
  "denominator": 4,
  "mixed": "3/4",
  "decimal": 0.75,
  "decimal_text": "0.75",
  "percent": 75,
  "exact": true
}

Simplify, with a mixed number

Input
{
  "value": "14/8"
}
Result
{
  "fraction": "7/4",
  "numerator": 7,
  "denominator": 4,
  "mixed": "1 3/4",
  "decimal": 1.75,
  "decimal_text": "1.75",
  "percent": 175,
  "exact": true
}

The closest simple fraction

Input
{
  "value": "3.14159",
  "max_denominator": 10
}
Result
{
  "fraction": "22/7",
  "numerator": 22,
  "denominator": 7,
  "mixed": "3 1/7",
  "decimal": 3.14285714286,
  "decimal_text": "3.(142857)",
  "percent": 314.285714286,
  "exact": false
}

Questions

What do the brackets in "decimal_text" mean?
The digits in brackets repeat for ever: 0.(3) is 0.333... and 0.1(6) is 0.1666... You can also type a value that way.
When is "exact" false?
When max_denominator forced an approximation. 3.14159 is exactly 314159/100000, but with a limit of 10 the closest fraction is 22/7.