SportAPI
API integration

Odds Formats in an API: Decimal, Fractional, American and Moneyline — With Conversion Code

An odds API returns decimal prices; fractional and American odds are a display choice. The same price in every notation, what moneyline means, conversion formulas with working code and rounding traps.

Four cards with the same price in different notations: decimal 2.50, fractional 3/2, American +150 and moneyline +150, with a row of conversion formulas below

An odds API returns one format: decimal. Fractional and American odds are the same price written differently, and your site produces them from the decimal number at display time. Decimal 2.50, fractional 3/2 and American +150 all mean one thing: a winning stake of 100 returns 250, and the implied probability is 40%.

Moneyline is not a fourth format. It’s the American name for a bet on who wins, and it’s usually quoted in American odds. So “moneyline odds from an API” means the win market of a match, with decimal prices you convert yourself.

Below: the same prices in every notation, the formulas, code you can paste, and the rounding traps that make a bet slip show a different number than the player clicked. The SportAPI Sports Odds API returns decimal odds in the oc_rate field.

The same price in four notations

DecimalFractionalAmericanImplied probabilityReturn on a stake of 100
1.501/2−20066.7%150
1.9110/11−11052.4%191
2.001/1 (evens)+10050.0%200
2.503/2+15040.0%250
3.4012/5+24029.4%340
11.0010/1+10009.1%1100

What each format tells the player

Decimal is the total return for one unit staked, stake included. 2.50 means 1 becomes 2.50. It’s the standard in continental Europe, Latin America, Africa and Australia, and it’s the easiest for calculations: an accumulator price is the product of the decimals.

Fractional is the profit relative to the stake. 3/2 means a profit of 3 for every 2 staked. It’s traditional in the United Kingdom and Ireland.

American has two forms. A positive number is the profit on a stake of 100: +150 wins 150. A negative number is the stake needed to win 100: −200 means staking 200 to win 100. Favourites are negative, underdogs positive. There are no values between −100 and +100.

Moneyline is a market, not a notation: a bet on the winner without a handicap. US sportsbooks show three main lines for a game, the moneyline, the spread and the total, all in American odds.

Asia has its own notations too: Hong Kong, Indonesian and Malay odds. They follow the same principle and convert from decimal by similar formulas.

What the API returns

Here is the win market of an NFL game from the feed on 9 November 2026, shortened:

{
  "group_name": "Team Wins",
  "oc_list": [
    { "oc_name": "W1", "oc_rate": 2.49, "oc_pointer": "..." },
    { "oc_name": "W2", "oc_rate": 1.562, "oc_pointer": "..." }
  ]
}

In American notation that’s a moneyline of +149 and −178. In fractional it’s about 3/2 and 9/16. The API doesn’t send those strings; it sends oc_rate, and the format is your interface’s job. How a selection is structured is described in the odds model.

Conversion formulas

From decimal dFormulaExample
To American, d ≥ 2.00(d − 1) × 1002.50 → +150
To American, d < 2.00−100 / (d − 1)1.50 → −200
To fractionald − 1 as a reduced fraction2.50 → 3/2
To implied probability1 / d2.50 → 40%
Back to decimalFormulaExample
From American, positive1 + a / 100+150 → 2.50
From American, negative1 + 100 / abs(a)−200 → 1.50
From fractional n/m1 + n / m3/2 → 2.50
From probability p1 / p0.40 → 2.50

Conversion code

Plain JavaScript with no dependencies, for the place where odds are rendered:

const gcd = (a, b) => (b ? gcd(b, a % b) : a);

function toAmerican(d) {
  const a = d >= 2 ? (d - 1) * 100 : -100 / (d - 1);
  const r = Math.round(a);
  return r > 0 ? `+${r}` : `${r}`;
}

function fromAmerican(a) {
  return a > 0 ? 1 + a / 100 : 1 + 100 / Math.abs(a);
}

// the nearest fraction with a small denominator: 1.91 -> 10/11, not 91/100
function toFractional(d, maxDen = 20) {
  const x = d - 1;
  let best = [1, 1];
  let err = Infinity;
  for (let den = 1; den <= maxDen; den++) {
    const num = Math.max(1, Math.round(x * den));
    const e = Math.abs(x - num / den);
    if (e < err - 1e-9) {
      best = [num, den];
      err = e;
    }
  }
  const g = gcd(best[0], best[1]);
  return `${best[0] / g}/${best[1] / g}`;
}

function formatOdds(decimal, format) {
  if (format === 'american') return toAmerican(decimal);
  if (format === 'fractional') return toFractional(decimal);
  return decimal.toFixed(2);
}

formatOdds(2.49, 'american');   // '+149'
formatOdds(1.562, 'american');  // '-178'
formatOdds(1.91, 'fractional'); // '10/11'

If you’d rather not maintain this, SportAPI publishes the same math as an open-source library, odds-tools, for Python and JavaScript. It needs no API key and installs with pip install odds-tools or npm install odds-tools:

from odds_tools import (convert, decimal_to_american, format_american,
                        decimal_to_fractional, margin, fair_odds)

format_american(decimal_to_american(2.49))       # '+149'
decimal_to_fractional(1.91, max_denominator=20)  # '10/11'
convert(-110, "american", "decimal")             # 1.909...
convert("5/2", "fractional", "american")         # 250.0

In JavaScript the functions have the same names in camelCase: decimalToAmerican, formatAmerican, decimalToFractional.

Rounding traps

American odds are rounded. Decimal 1.91 is −109.89, shown as −110. Convert −110 back and you get 1.909, not 1.91. The difference is small, but on a large stake the payout changes.

Fractions are approximations. 1.91 is exactly 91/100, but no bookmaker writes that; the traditional fraction is 10/11, which is 1.909. And 2.49 is shown as 3/2, which is 2.50. A fraction with a small denominator is a label, not the price.

Never convert back. From those two points follows the main rule: store the decimal value from the API, convert it only for display, and calculate the payout from the decimal. If your code turns +149 back into a decimal and uses that for money, it will eventually disagree with the accepted bet.

Send the original to the bet service. When a player confirms the slip, your server sends the selection’s pointer and the decimal odds from the feed to the Coupon API. The bet is accepted and settled at the decimal price. What the player saw as +149 or 3/2 is presentation.

Mind the edges. Decimal 2.00 is +100 and 1/1. Very short prices such as 1.01 become −10000 and need a larger denominator for a meaningful fraction.

Implied probability and margin

The implied probability of a price is 1 / d. Add the probabilities of all outcomes of one market and you get more than 100%; the excess is the bookmaker’s margin.

For a 1x2 market priced 2.10, 3.40 and 3.60:

OutcomeDecimalImplied probabilityFair odds without margin
Home2.1047.6%2.20
Draw3.4029.4%3.56
Away3.6027.8%3.77
Total104.8%

The margin is 4.81%. Dividing each probability by the total gives the fair probabilities, and their reciprocals are the fair odds. With the library:

prices = [2.10, 3.40, 3.60]
margin(prices)      # 0.0481 -> 4.81 %
fair_odds(prices)   # [2.201, 3.563, 3.773]

This is what prediction and analytics products need from an odds feed: probabilities, not notations.

Let the player choose

A site with an international audience offers a switch. Pick the default from the market and remember the player’s choice:

// a sensible default by country; the player's own choice always wins
const DEFAULT_FORMAT = { US: 'american', GB: 'fractional', IE: 'fractional' };

function oddsFormatFor(user) {
  return user.oddsFormat || DEFAULT_FORMAT[user.country] || 'decimal';
}

Convert in the browser or at render time, and keep the cache of API data in decimal. One cached response then serves players in every format.

Mistakes that cost money or trust

  1. Storing converted odds. Keep the decimal from the API; convert for display only.
  2. Calculating the payout from a rounded value. Use oc_rate, not −110 or 10/11.
  3. Showing 91/100. Reduce to a traditional fraction with a small denominator.
  4. Dropping the plus sign. +150 without the plus reads as a different notation.
  5. Treating moneyline as a format. It’s the win market; the format is American.
  6. Different formats on one page. The match list, the match page and the slip must use the same setting.

What it costs

What you needCost
The odds feed for one sport: prematch and live, decimal odds for every marketfrom $30 a month
Bet acceptance and automatic settlementfrom $300 a month
The odds-tools libraryfree, open source
Testing before you payfree two-day test key, all sports

FAQ

What odds format does the API return?

Decimal, in the oc_rate field of every selection. Fractional and American odds are produced on your side at display time.

Is moneyline a separate odds format?

No. Moneyline is the bet on the winner of a game. It’s usually written in American odds, so +150 is a moneyline price, not a moneyline format.

How do I convert decimal odds to American?

For 2.00 and above, subtract one and multiply by 100: 2.50 becomes +150. Below 2.00, divide −100 by the decimal minus one: 1.50 becomes −200. Round to a whole number.

Why does 1.91 show as 10/11 and not 91/100?

Because fractional odds use a traditional set of fractions with small denominators. 10/11 is the closest one, and it equals 1.909. Use it as a label and keep 1.91 for calculations.

Does the display format change the payout?

It must not. The bet is accepted at the decimal price from the feed. If the payout differs by format, the code is calculating from a rounded value.

Which format should my site use by default?

Decimal for most markets, American for a US audience, fractional for the UK and Ireland. Add a switch and remember the choice.

Check the conversion on real prices

Take a test key, request any match and print its win market in three notations with the code above. Then compare the payout calculated from oc_rate with the one implied by the rounded American value; that difference is the reason to keep decimals. Ask the SportAPI manager on Telegram for the API domain and the key.

← All articles