Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
World desk6 min

Build a Sports Odds Converter With JavaScript

Create a JavaScript browser tool that converts American, decimal, and fractional odds, then calculates odds-implied probability and stake-based payout and profit.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Build the converter around decimal odds: parse the selected format, convert it to decimal, then calculate the other formats, implied probability, and—if entered—total payout and profit. This keeps the math consistent while making the key distinction clear: decimal odds include the returned stake in a winning payout; American and fractional odds describe profit relative to stake.

What the three odds formats mean

American, decimal, and fractional odds express the same price using different conventions. Decimal odds are a direct multiplier for the total payout on a win. Fractional odds state profit relative to stake. American odds use a positive or negative value around even money: positive odds state the profit on a $100 stake, while negative odds state how much must be staked to profit $100.

As an Amazon Associate I earn from qualifying purchases.

Format Example What it expresses Common convention
American +150 or −125 Positive: profit per $100 staked. Negative: stake needed to profit $100. Common in US-facing examples; regional usage is not universal.
Decimal 2.50 Total payout per unit staked, including the original stake. Common in many European examples.
Fractional 3/2 Profit relative to stake: 3 units of profit for every 2 staked. Common in UK contexts and horse-racing coverage.

These regional labels are general conventions, not rules. Decimal odds are especially convenient for comparing prices because multiplying the stake by the decimal price gives the total return on a win.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How to convert each format

Use decimal odds, represented below by D, as the intermediate value. For American odds, A is the signed number; for fractional odds, A/B is the profit-to-stake ratio.

#1 Best Overall
Sports Betting Calculator
  • Bet type calculators
  • Odds conversion calculators
  • Bet Stake calculators

American odds to decimal

  • For positive American odds, D = 1 + A/100. For example, +150 becomes 2.50.
  • For negative American odds, D = 1 + 100/|A|. For example, −125 becomes 1.80.

Fractional odds to decimal

For fractional odds A/B, calculate D = 1 + A/B. Thus 3/2 becomes 2.50, and 4/5 becomes 1.80. The fraction represents profit, so the additional 1 accounts for the stake returned in decimal odds.

Decimal odds to American

  • At even money or above, when D ≥ 2, calculate A = 100 × (D − 1). For 2.50, this gives +150.
  • Below even money, when 1 < D < 2, calculate A = −100/(D − 1). For 1.80, this gives approximately −125.

Decimal odds of 2.00 are even money. Values above 2.00 produce positive American odds; values between 1 and 2 produce negative American odds.

Rank #2
Sale
KAIU Sports Betting Log Book – 124 Pages 6''x9'',
  • MORE SPACE FOR REAL TRACKING: Designed with extra writing space compared to typical betting trackers—log bets, strategies, and insights instead of just numbers
  • DISCIPLINED BETTING SYSTEM: Set limits, track units, and stay consistent. Build smarter habits and eliminate emotional betting with structured logging pages
  • BUILT-IN WEEKLY & MONTHLY PROFIT CALCULATOR: Quickly see your performance with dedicated profit tracking pages. Analyze wins, losses, and trends to make smarter bets over time
  • PROFESSIONAL LOGGING STRUCTURE: Organized pages feature betting summary, notes, and detailed logs—ideal for serious sports bettors and data-driven users
  • PREMIUM QUALITY YOU CAN FEEL: Compact 6x9 size, 124 pages, smooth 120gsm paper, durable thick cover, and strong double metal coil—perfect for daily use anywhere

Decimal odds to fractional

Subtract 1 from decimal odds to get the profit-to-stake ratio, then express that ratio as a fraction and reduce it if desired. For example, 2.50 − 1 = 1.50, or 3/2. If the decimal value has been rounded for display, the fractional equivalent may only be approximate.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Implied probability, payout, and profit

Calculate odds-implied probability

Convert the price to a raw implied probability using the matching formula:

Rank #3
Sports Betting Logbook Sports, 100 Pages with Monthly P&L & Odds Converter
  • CONVENIENT SIZE - Medium size (8.25" x 5.83")
  • RECORDING AND PLANNING - Ideal for recording all your bets with a handy note section on each day page. Ideal for looking back when planning future bets
  • SUITABLE FOR ALL SPORTS - Perfect for horse racing, football, tennis, cricket, baseball, basketball, ice hockey, etc
  • CONVENIENT AND EASY TO USE - Convenient headlines to record all your betting activities
  • Lying Flat The sturdy spiral binding allows the notebook to rotate 360 degrees, making it very convenient to complete the log
  • Decimal odds: p = 1/D.
  • Positive American odds: p = 100/(A + 100) percent.
  • Negative American odds: p = |A|/(|A| + 100) percent.
  • Fractional odds A/B: p = B/(A + B).

For a browser display, multiply a decimal probability by 100 to show a percentage. Label this result “implied probability” or “odds-implied probability,” not the true chance of an outcome. Bookmaker prices can include a margin, so the displayed probability may not be a fair estimate. The World Lottery Association’s 2024 Code of Practice, section L.6, “Sports, esports, and horse race betting,” explains that “the odds-on display does not represent the true chances that the event will, or will not occur, but are the amount that the company will pay out on a winning bet, together with the required stake.”

Keep payout separate from profit

For stake S at decimal odds D, total payout on a win is S × D; profit is S × (D − 1). A $10 stake at 2.50 returns $25 total, of which $15 is profit. Another example: a $20 stake at American −125 is equivalent to 1.80 decimal and 4/5 fractional, producing a $36 total payout and $16 profit on a win.

Rank #4
Betting and Parlay Calculator
  • Best Betting and Parlay Calculator. Quick and effective.

Implement the converter in JavaScript

The following single-file example runs in a browser without a library. It uses strict input checks, converts through decimal odds, and updates the result as the form is submitted. The accepted format is an implementation choice: American input may include a leading plus or minus sign, decimal input must be greater than 1, and fractional input uses a numerator and denominator separated by a slash.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
<form id="odds-form">
  <label>
    Input format
    <select id="format">
      <option value="american">American</option>
      <option value="decimal">Decimal</option>
      <option value="fractional">Fractional</option>
    </select>
  </label>
  <label>
    Odds
    <input id="odds" type="text" inputmode="decimal" placeholder="+150, 2.50, or 3/2">
  </label>
  <label>
    Stake (optional)
    <input id="stake" type="text" inputmode="decimal" placeholder="10.00">
  </label>
  <button type="submit">Convert</button>
</form>
<p id="error" role="alert"></p>
<section id="result" aria-live="polite"></section>

<script>
  function parseOdds(format, raw) {
    const text = raw.trim();
    if (!text) throw new Error("Enter odds to convert.");

    if (format === "american") {
      if (!/^[+-]?d+(?:.d+)?$/.test(text)) {
        throw new Error("Enter American odds as a number, such as +150 or -125.");
      }
      const american = Number(text);
      if (!Number.isFinite(american) || american === 0) {
        throw new Error("American odds must be a nonzero number.");
      }
      return american > 0
        ? 1 + american / 100
        : 1 + 100 / Math.abs(american);
    }

    if (format === "decimal") {
      if (!/^d+(?:.d+)?$/.test(text)) {
        throw new Error("Enter decimal odds as a number greater than 1.");
      }
      const decimal = Number(text);
      if (!Number.isFinite(decimal) || decimal <= 1) {
        throw new Error("Decimal odds must be greater than 1.");
      }
      return decimal;
    }

    if (format === "fractional") {
      const match = /^(d+(?:.d+)?)/(d+(?:.d+)?)$/.exec(text);
      if (!match) throw new Error("Enter fractional odds as numerator/denominator, such as 3/2.");
      const numerator = Number(match[1]);
      const denominator = Number(match[2]);
      if (!Number.isFinite(numerator) || !Number.isFinite(denominator) || denominator <= 0) {
        throw new Error("Use a nonnegative numerator and a positive denominator.");
      }
      const decimal = 1 + numerator / denominator;
      if (!Number.isFinite(decimal) || decimal <= 1) {
        throw new Error("These odds must produce a decimal value greater than 1.");
      }
      return decimal;
    }

    throw new Error("Choose a supported odds format.");
  }

  function formatAmerican(decimal) {
    if (decimal >= 2) return `+${(100 * (decimal - 1)).toFixed(0)}`;
    return `-${(100 / (decimal - 1)).toFixed(0)}`;
  }

  function formatFractional(decimal) {
    const profit = decimal - 1;
    const denominator = 1000;
    const numerator = Math.round(profit * denominator);
    function gcd(a, b) {
      return b === 0 ? a : gcd(b, a % b);
    }
    const divisor = gcd(Math.abs(numerator), denominator);
    return `${numerator / divisor}/${denominator / divisor}`;
  }

  const form = document.querySelector("#odds-form");
  const error = document.querySelector("#error");
  const result = document.querySelector("#result");

  form.addEventListener("submit", (event) => {
    event.preventDefault();
    error.textContent = "";
    result.replaceChildren();

    try {
      const format = document.querySelector("#format").value;
      const decimal = parseOdds(format, document.querySelector("#odds").value);
      const impliedProbability = 100 / decimal;
      const values = [
        ["Decimal", decimal.toFixed(2)],
        ["American", formatAmerican(decimal)],
        ["Fractional (approx.)", formatFractional(decimal)],
        ["Odds-implied probability", `${impliedProbability.toFixed(2)}%`]
      ];

      const stakeText = document.querySelector("#stake").value.trim();
      if (stakeText) {
        if (!/^d+(?:.d+)?$/.test(stakeText)) {
          throw new Error("Enter a stake as a nonnegative amount, such as 10 or 10.50.");
        }
        const stake = Number(stakeText);
        if (!Number.isFinite(stake)) throw new Error("Enter a finite stake amount.");
        values.push(["Total payout on a win", (stake * decimal).toFixed(2)]);
        values.push(["Profit on a win", (stake * (decimal - 1)).toFixed(2)]);
      }

      const list = document.createElement("dl");
      for (const [label, value] of values) {
        const term = document.createElement("dt");
        const description = document.createElement("dd");
        term.textContent = label;
        description.textContent = value;
        list.append(term, description);
      }
      result.append(list);
    } catch (exception) {
      error.textContent = exception.message;
    }
  });
</script>
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Why the implementation validates and rounds

Reject malformed or unusable values

Reading the field as text and validating the whole string prevents permissive parsing from accepting a valid-looking prefix while ignoring trailing characters. The code rejects zero American odds, decimal odds at or below 1, malformed fractions, and fractions with a zero denominator. Those checks prevent invalid values, division by zero, and NaN or infinity from flowing into the display. The stake field is optional and, when supplied, accepts a nonnegative numeric amount.

Best Value
Sharp 8-Digit Dual Power Pocket Calculator, Gray/Blue (EL-243SB)
  • PROTECTIVE HINGED COVER: Features a hinged, hard cover that protects the keys and display when stored, making this handheld calculator durable and easy to carry safely.
  • DUAL-POWER SOURCE: Runs on solar energy with a battery backup, ensuring consistent and reliable use in any lighting condition or environment.
  • LCD SCREEN SIZE: The 2-inch screen size, 8-digit LCD screen clearly shows each digit, helping to prevent reading errors and making numbers easy to read at a glance.
  • CONVENIENT FUNCTION KEYS: Includes a 3-key independent memory, square root key, change sign key, automatic power down, and more to provide efficient, reliable everyday math.
  • TRUSTED BY WORKPLACES FOR DECADES: Sharp has been a dependable name in office calculation for generations — practical tools built around the way people actually work.

Choose display precision deliberately

The example rounds decimal odds to two places, American odds to whole numbers, and the fractional display to a ratio based on a denominator of 1000 before reduction. These are display choices, not universal standards; rounding means a converted value may not reproduce the original exactly. The fractional label marks the result approximate for that reason.

For production use, consider a more sophisticated fraction-reduction strategy if you need simple conventional fractions rather than a bounded approximation. Also consider currency formatting if the utility supports specific currencies; the example treats stake and payout as plain numeric amounts and does not assume a currency.

What the converter can and cannot tell you

The tool can translate odds formats and calculate arithmetic consequences of a stated price and stake. Its implied probability is a transformation of that price, not an independent assessment of an event. A bookmaker’s margin may be embedded in quoted odds, so a converter should not present the result as a prediction or “true” chance.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Quick Recap

Bestseller No. 1
Sports Betting Calculator
Sports Betting Calculator
Bet type calculators; Odds conversion calculators; Bet Stake calculators
Bestseller No. 3
Sports Betting Logbook Sports, 100 Pages with Monthly P&L & Odds Converter
Sports Betting Logbook Sports, 100 Pages with Monthly P&L & Odds Converter
CONVENIENT SIZE - Medium size (8.25" x 5.83"); CONVENIENT AND EASY TO USE - Convenient headlines to record all your betting activities
$12.50
Bestseller No. 4
Betting and Parlay Calculator
Betting and Parlay Calculator
Best Betting and Parlay Calculator. Quick and effective.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.