Ratiofit

Small terms. A visible compromise.

Find a whole-number ratio for your decimal.

Choose the largest numerator and denominator you want to use. Ratiofit finds the closest positive p:q within those limits and shows exactly how far it is from your entered target.

Free · No signup · Exact comparisons

Set your target and caps

Greater than 0, up to 1000000; at most 12 decimal places. Enter 0.5 rather than .5. No signs, fractions, colons, units or exponents.

Each cap is a whole integer from 1 to 10000. Both selected terms must be positive. The caps are independent; there is no fixed sum.

Editing a field clears the old result. Press Calculate ratio when your three inputs are ready.

Two genuine limits

A target near 1.7778 can use 16:9 with caps of 20 each. Limit the numerator to 8 and denominator to 10, and the closest pair becomes 7:4. A denominator-only shortcut does not enforce both caps.

A tiny error is still an error

The entered decimal 1.777777777778 is close to 16/9, but it is not exactly equal. This tool keeps that finite decimal as the target and shows the remaining difference instead of calling it exact.

Know the tie rule

For target 0.75 with p ≤ 1 and q ≤ 2, both 1/2 and 1 are 0.25 away. Ratiofit chooses the lower value, 1:2. See the tie examples.

A numerical helper for small proportions

Use the calculator when you have a desired dimensionless proportion and want modest positive whole-number terms. A layout sketch or model diagram might be easier to label with a short p:q pair. You decide which caps and approximation error are suitable; the result does not promise that a physical part, print, mechanism or material will fit.

This tool does not convert units, distribute a fixed total, interpret irrational symbols or optimize a tolerance band. Its objective is only the smallest absolute difference in ratio value within your caps. Read the method and original worked examples before using a result.