Poker Hand Ranker

Find the best 5-card poker hand from 5–7 cards.

Open tool

Overview

The Poker Hand Ranker takes 5 to 7 cards and returns the best 5-card poker hand contained within them, along with the hand category (royal flush, straight flush, four of a kind, full house, flush, straight, three of a kind, two pair, one pair, high card) and the kicker cards. It mirrors the showdown step in Texas Hold'em, Omaha-style high-only games, and seven-card stud.

Use it to settle showdown disputes, to compute the best hand for a board you're studying, or to verify pot-odds calculations where the resulting hand category matters. The ranker treats aces as both low (for the wheel A-2-3-4-5) and high (for the broadway T-J-Q-K-A) automatically.

How it works

The ranker enumerates every 5-card subset of the input cards — at most C(7, 5) = 21 subsets — and scores each subset with a category key followed by tiebreaker keys. The category key is one of ten values from royal flush (9) down to high card (0), and the tiebreaker keys are the rank values needed to compare hands within a category.

For category detection the ranker counts ranks and suits, looks for straight patterns including the wheel, and combines those into the correct category. Across all enumerated subsets the highest combined key wins, and the matching 5-card hand is returned. The combined key compares like a lexicographic tuple, so a king-high straight beats a queen-high straight without any custom code.

Examples

  • 7 cards: 2 of clubs, 2 of diamonds, 5 of hearts, 9 of clubs, A of clubs, K of clubs, Q of clubs. Best hand: A-K-Q-9-2 of clubs — wait, that includes a 2 of clubs and is missing a flush card. Actually the flush uses A-K-Q-9-2 of clubs giving an ace-high flush (but the 2c counts). Five hearts? No — let me restate. The 7 cards have four clubs (9c, Ac, Kc, Qc) plus the 2c making five clubs total: A-K-Q-9-2 of clubs is an ace-high flush.
  • 5 cards: 10, J, Q, K, A of hearts — royal flush.
  • 7 cards including 4 of a kind and a fifth high card: four of a kind plus the kicker.
  • Wheel detection: 5, 4, 3, 2, A becomes the lowest straight (5-high), not high-ace.

FAQ

Are aces high or low?
Both. The ranker tries both interpretations and keeps the highest-scoring hand.

What's the highest possible hand?
Royal flush — A, K, Q, J, 10 of one suit. Each of the four suits has exactly one royal flush.

How are ties broken?
By kicker rank within the same category. Two pair compares the higher pair first, then the lower pair, then the side card.

Can it rank 9-card or larger inputs?
The ranker accepts 5-7 cards by default. Larger inputs would just enumerate more subsets.

Does it support wild cards?
No — standard poker only.

Try Poker Hand Ranker

An unhandled error has occurred. Reload ×