I’m trying to create a backend for a Poker odds calculator.

I know how to go about calculating odds post-flop, but I’m having a hard time calculating the odds pre-flop.

How do I go about calculating pre-flop odds with all the hands involved revealed? like in an all-in situation.

  • there are many common hand vs hand known percentages out there for heads up. for example 2 overcards vs a pair or an over-under hand vs a hand in the middle (ex. AT vs KQ). you may be able to incorporate these known percentages
    – Clarko
    Commented Jan 31, 2021 at 0:00
  • If you're OK with an approximate result, run a simulation of 100,000 hands or so. If you want to be exact, run the hands with all 1.7 million boards and add up the results. There are plenty of poker libraries in several programming languages fast enough to do this. Commented Nov 5, 2021 at 18:00

1 Answer 1


You can do this through simulation, but that might not be very convenient if you are writing a backend. I would start with the following method:

  • keep track of which hand is the best before any cards are dealt (AT > KQ, 33 > 22, 55 > AK)
  • calculate any possible outs that the worse hand could hit to become the best hand, including any possible straights or flushes
  • start each of the worse hands at 0% and the best hand at 100%, then for each out the worse hands have, add the probability that they will hit that out in the next 5 cards to their total while subtracting that from the total of the best hand.

With more than 2 hands all-in it gets a little murky doing it this way, you will have to split up the probability subtraction part among multiple hands. You can easily experiment and adjust using tools like pokerstove that do run large numbers of simulations and compare that to your results.

Also keep in mind that because there are no draws preflop, you can hard code some percentages for a hand to hit a flush/straight. With 2 suited cards there is ~6% chance of hitting a flush by the river. With non-connected cards there is a probability of hitting a 4 card straight and connected cards have a constant probability of hitting a straight based on how big the gap between the cards is.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.