Convert between American, Decimal & Fractional odds
AmericanDecimalFractional
American Odds—
Decimal Odds—
Fractional Odds—
Implied Probability—
For informational purposes only. Not legal gambling advice. Must be 21+ in your jurisdiction. Gamble responsibly. If you or someone you know has a gambling problem, call 1-800-522-4700.
// Converter
let inputType = 'american';
document.querySelectorAll('.pill').forEach(pill => {
pill.addEventListener('click', () => {
document.querySelectorAll('.pill').forEach(p => p.classList.remove('active'));
pill.classList.add('active');
inputType = pill.dataset.type;
convert();
});
});
document.querySelectorAll('.preset-btn').forEach(btn => {
btn.addEventListener('click', () => {
document.getElementById('oddsInput').value = btn.dataset.val;
convert();
});
});
function toFraction(decimal) {
const tolerance = 1.0E-6;
let h1 = 1, h2 = 0, k1 = 0, k2 = 1, b = decimal;
do {
let a = Math.floor(b);
let aux = h1; h1 = a * h1 + h2; h2 = aux;
aux = k1; k1 = a * k1 + k2; k2 = aux;
b = 1 / (b - a);
} while (Math.abs(decimal - h1 / k1) > decimal * tolerance);
return k1 === 1 ? h1.toString() : h1 + '/' + k1;
}
function convert() {
const input = document.getElementById('oddsInput').value.trim();
if (!input) return;
let american, decimal, fractional, implied;
if (inputType === 'american') {
american = parseInt(input);
if (american > 0) {
decimal = (american / 100) + 1;
} else {
decimal = (100 / Math.abs(american)) + 1;
}
} else if (inputType === 'decimal') {
decimal = parseFloat(input);
if (decimal >= 2) {
american = Math.round((decimal - 1) * 100);
} else {
american = Math.round(-100 / (decimal - 1));
}
} else {
const parts = input.split('/');
if (parts.length === 2) {
decimal = (parseInt(parts[0]) / parseInt(parts[1])) + 1;
if (decimal >= 2) {
american = Math.round((decimal - 1) * 100);
} else {
american = Math.round(-100 / (decimal - 1));
}
}
}
fractional = toFraction(decimal - 1);
implied = (1 / decimal * 100).toFixed(1);
document.getElementById('americanResult').textContent = (american > 0 ? '+' : '') + american;
document.getElementById('decimalResult').textContent = decimal.toFixed(3);
document.getElementById('fractionalResult').textContent = fractional;
document.getElementById('impliedResult').textContent = implied + '%';
document.getElementById('results').classList.remove('hidden');
}
document.getElementById('oddsInput').addEventListener('keypress', (e) => {
if (e.key === 'Enter') convert();
});