Projects › Games › Cribbage calculator
Free cribbage calculator and hand scorer, and how to make your own
Pick your four cards and the starter, and it counts the hand for you: every fifteen, pair, run, flush and his nobs, each one shown on the cards. Switch to the crib with one tap. Dealt six cards? It works out which two to throw, whether it's your crib or theirs. Nothing is uploaded. Then make your own cribbage calculator with a free AI assistant.
Loading the cribbage calculator…
How to score a cribbage hand
After each round, every hand is counted with the starter: the card cut from the pack and turned face up. The player who didn't deal counts first, then the dealer counts their hand, then the dealer counts the crib. Here's what scores.
| What | Points | How it works |
|---|---|---|
| Fifteens | 2 each | Every different group of cards that adds up to 15. Jacks, queens and kings count 10, aces count 1. 7 + 8 is a fifteen, and so is 5 + K or A + 4 + K. |
| Pairs | 2 each | Two cards of the same rank. Three of a kind is three pairs, so 6. Four of a kind is six pairs, so 12. |
| Runs | 1 per card | Three or more ranks in a row, like 3-4-5. Each different way of making the run counts again, so 3-4-4-5 is two runs of 3. Ace is low only: Q-K-A isn't a run. |
| Flush | 4 or 5 | All four hand cards the same suit scores 4, or 5 if the starter matches too. In the crib, only a five-card flush counts. |
| His nobs | 1 | A jack in your hand (or the crib) of the same suit as the starter. |
| His heels | 2 to the dealer | If the starter itself is a jack, the dealer pegs 2 straight away. It isn't part of any hand. |
Example: 4♥ 5♦ 6♣ 6♠ with a 5♠ starter. There are four fifteens (4 + 5 + 6, four different ways) for 8, two pairs for 4, and four runs of 4-5-6 for 12. That’s 24, one of the best hands there is. The best is 29: three 5s and a jack, with the fourth 5 cut as the starter in the jack's suit. No hand can score 19, 25, 26 or 27. Try any hand in the calculator, or find out which cards to keep.
Your own cribbage scorer that shows its working
You'll describe the calculator to a free AI assistant, paste what it writes into a file, and open it in your browser. Then add the breakdown, a quick card picker, the crib rules and a "which cards to keep" helper, one step at a time.
- A hand scorer that counts fifteens, pairs, runs, flushes and his nobs by the proper rules
- A breakdown of every combination, like "15 for 2: 5♥ + J♠", that lights up the cards when you tap it
- A card picker made for thumbs: tap a rank, then a suit, or type the cards in
- A crib switch that applies the crib's flush rule, and a reminder about his heels
- A helper that takes the six cards you were dealt and ranks all 15 ways to keep four, for your crib or theirs
- A felt table and proper-looking cards that work nicely on a phone at the table
Good for: anyone learning cribbage, families settling "is that really 12?" arguments, players who want to get better at choosing what to throw, and anyone who likes seeing a computer check every possibility in a blink.
What you need
Build it in six steps
Step 1 gives you a simple version that works, and each step after it adds more. The calculator at the top of this page is roughly what you'll have once you've done every step. Yours will look a bit different, because the AI writes its own version each time.
Ask for a simple hand scorer
Copy this prompt into your AI assistant. It spells out the scoring rules, because AI assistants often get a cribbage detail or two wrong if you just say "score a cribbage hand".
Copy this promptI don't know how to code. Please make me a cribbage hand calculator that runs in a web browser. Requirements: - ONE single HTML file (HTML, CSS and JavaScript together), no external libraries, no internet needed. I will save it and double-click it. - Five cards: four for my hand and one for the starter (the cut card). For each card, a drop-down for the rank (A, 2 to 10, J, Q, K) and one for the suit (spades, hearts, diamonds, clubs). - A "Count" button that shows the total, scored by these rules, using all five cards: - Fifteens: 2 points for EVERY different combination of cards (2, 3, 4 or 5 cards) that adds up to 15. Jacks, queens and kings count 10, aces count 1. Check every possible group, not just pairs of cards. - Pairs: 2 points for every pair of cards with the same rank. So three of a kind is 6 and four of a kind is 12. - Runs: three or more ranks in a row, 1 point per card. Only count the longest run. If a rank in the run appears twice, the run counts twice (3-4-4-5 is two runs of 3 = 6). Ace is always low: Q-K-A is not a run. - Flush: if all four hand cards are the same suit, 4 points, or 5 if the starter matches too. - His nobs: 1 point for a jack in the hand (not the starter) that is the same suit as the starter. - If the same card is chosen twice, show a message instead of a score. - A clean, friendly design with a dark green background like a card table. Please give me the complete file in one code block, then tell me in simple steps how to save and open it.
Copy the code, paste it into your text editor, and save it as cribbage.html. Double-click it, choose five cards and press Count.
Test it with the 29 hand. 5♥ 5♦ 5♣ J♠ in the hand and 5♠ as the starter must score 29. Then try 4♥ 5♦ 6♣ 6♠ with a 5♠ starter, which should be 24.Show the breakdown
A total on its own doesn't help you learn, or win an argument. This step lists every combination the way a cribbage player would count it out loud.
Copy this promptThat works, thank you. Now please show how the hand scores, not just the total: - Score automatically whenever a card changes, so I don't need the Count button. - Show the total big and bold, and under it small chips for each part: 15s, Pairs, Runs, Flush, Nobs, with the points for each. - Under that, a breakdown in groups (Fifteens, Pairs, Runs, Flush, His nobs), with one line for each combination, such as "15 for 2: 5♥ + J♠", "Pair for 2: 5♥ 5♦", "Run of 3 for 3: 4♣ 5♥ 6♠" and "His nobs for 1". Show three of a kind as one line, "Three of a kind for 6", and four of a kind as "Four of a kind for 12". List each run separately, so a double run shows as two runs. - Show the cards as small playing cards with red hearts and diamonds. - When I hover over a line, or tap it on a phone, light up those cards and fade the others. - Add a line that says the count the way players say it, such as "Fifteen 2, fifteen 4, a pair is 6, and a run of 3 is 9." - If the hand scores nothing, say so, and explain that cribbage players jokingly call it "nineteen" because 19 is impossible. - Underneath, a small note: "The highest hand is 29. A hand can never score 19, 25, 26 or 27." Send me the complete updated file.
Always ask for the complete file. Replace everything in cribbage.html, save, and refresh the tab (F5 or Cmd+R).Make a quick card picker
Drop-downs are slow, especially on a phone. Real cards on a table, picked with two taps each, feel far better.
Copy this promptPlease replace the drop-downs with a quicker card picker: - Show five card spaces on the green table: four for the hand and, a little apart, one labelled "Starter". Draw the cards with CSS (white, rounded, the rank and suit in the corner and a big suit symbol in the middle), not pictures. - Under the table, a row of 13 rank buttons (A, 2 to 10, J, Q, K) and four big suit buttons (♠ ♥ ♦ ♣). Tap a rank, then a suit, and that card goes into the next empty space. If I tap the suit first, that works too. - Never allow the same card twice: grey out a suit button if that card is already on the table. - Tap a card on the table to select it, so the next card I pick replaces it. Tap it again to remove it. - A text box where I can type a hand instead, like "5H 5D 5C JS 5S" or "5h5d5cjs 5s", or with 10 or T for tens. The fifth card is the starter. If it can't read something, say which bit and how to write it. - A "Random hand" button that deals five different cards, and a "Clear" button. - Put the total on the table under the cards, so it's right next to them. Send me the complete updated file.
Add the crib rules
The crib is counted almost the same way as a hand, with one difference that catches people out: the flush.
Copy this promptPlease add a "Crib hand" switch next to the buttons: - When it's on, label the four cards "The crib" instead of "Your hand". - In the crib, a flush only counts if all four crib cards AND the starter are the same suit (5 points). A four-card flush in the crib scores nothing. If the four crib cards match but the starter doesn't, show a note explaining why the flush isn't counted. - Everything else (fifteens, pairs, runs and his nobs) is counted exactly the same in the crib. - If the starter is a jack, show a note: "His heels: the starter is a jack, so the dealer pegs 2 straight away. That isn't part of the hand total." Don't add it to the total. Send me the complete updated file.
Check it: 2♥ 4♥ 6♥ 8♥ with a K♠ starter is 4 as a hand and 0 as a crib.Add a "which cards to keep" helper
This is the clever bit. You're dealt six cards and must throw two into the crib. The computer can try every choice against every possible starter faster than you can shuffle.
Copy this promptPlease add a second tab at the top called "Which cards to keep", next to "Score a hand": - It has six card spaces and the same picker, text box, Random and Clear buttons. - When all six cards are in, try all 15 ways of keeping four and throwing two. For each one, score the four kept cards with every one of the 46 cards that could be cut as the starter, and work out the average, lowest and highest score. - Also estimate what the two thrown cards are worth in the crib: average the crib score over every possible starter and every possible pair of other cards the opponent might throw (treat them as random cards from the 46 you can't see). Use the crib flush rule. - Two summary boxes: "You dealt: your crib" (best by hand average plus the crib estimate) and "They dealt: their crib" (best by hand average minus the crib estimate). Each shows the four cards to keep and the two to throw. - Tapping a box ranks the full list that way. Show the top 6 ways in a numbered list, each with the cards to keep, the two to throw (faded), the hand average, the lowest and highest, the crib estimate and the overall figure, and a "Show all 15" link. - Tapping a line in the list lifts the four kept cards on the table and tips the thrown ones aside. - Write the scoring so it's fast, because the crib estimate scores hundreds of thousands of hands. It should finish in well under a second. - A small note: "Hand points are averaged over all 46 cards that could be cut. The crib estimate assumes the other two crib cards are random. Pegging isn't counted." Send me the complete updated file.
Try 5♦ 5♠ J♦ K♠ 2♣ 6♥. Keeping 5-5-J-K should come out on top for both of you, averaging about 12 points.Polish it for the phone at the table
The last step makes it feel finished, so it's a pleasure to use with one thumb while someone waits for you to count.
Copy this promptPlease finish it off: - Make it work well on a phone 375 pixels wide: the table first, then the picker, then the breakdown underneath. Nothing should scroll sideways. On a phone, put the rank buttons in two rows (A to 7, then 8 to K), and make every button at least 44 pixels tall. - On a big screen, put the table and picker on the left and the breakdown on the right. - Make the table look like green felt with a soft light in the middle, and give the cards a gentle shadow. - Small animations: each new card slides in like it's being dealt, the total pops when it changes, and the next empty space glows softly. Keep these playing even if my device is set to reduce motion, because they're small and gentle. - Start with an example hand already on the table, so the page shows a score straight away. The first card I pick clears it and starts my own hand. - Make everything work with the keyboard, with a clear outline on the button that has focus. Send me the complete updated file.
Quick fixes
Double runs score too little
A very common AI mistake: it counts 3-4-4-5 as one run instead of two. Tell the AI: "Find the longest stretch of ranks in a row, then multiply its length by how many cards there are of each rank in it. 4♥ 5♦ 5♣ 6♠ with a 9♠ starter should score 14: three fifteens for 6, a pair for 2 and two runs of 3 for 6."
Jacks, queens and kings are counted wrong in the fifteens
Picture cards must count 10 when adding up to 15, but 11, 12 and 13 when looking for runs. Ask: "For fifteens, J, Q and K are worth 10 and an ace is worth 1. For runs and pairs, use their rank order, A = 1 up to K = 13. Please keep these two separate."
The 29 hand comes out as 28 or less
It's probably missing some fifteens, usually the ones made of three or four cards. Ask: "Please find fifteens by checking every one of the 26 groups of two or more cards from the five cards, not just pairs. 5♥ 5♦ 5♣ J♠ with a 5♠ starter must score 29."
Q-K-A is counted as a run
In cribbage the ace is always low, so runs never wrap round. Ask: "Ace is rank 1 only. Q-K-A and K-A-2 are not runs."
The crib scores a four-card flush
Ask: "In the crib, only score a flush when all five cards, including the starter, are the same suit. A hand scores 4 for four matching hand cards, but the crib doesn't."
His nobs is wrong
His nobs needs the jack to be in the hand, not cut as the starter, and to match the starter's suit. Ask: "His nobs is 1 point for a jack among the four hand cards whose suit matches the starter. A jack as the starter is his heels, 2 for the dealer, and isn't part of the hand score."
The keep helper freezes the page
The crib estimate scores a lot of hands. Ask: "Please make the scoring function fast: no new arrays inside it, count fifteens with a running table of ways to make each total from 0 to 15, and only show the result once all 15 options are done."
It opens as text
Re-save as plain text with exactly .html at the end, not .txt.
Questions people ask
How do you score a cribbage hand?
Count your four cards together with the starter. Score 2 for every combination that adds up to 15 (picture cards count 10, aces 1), 2 for every pair, 1 per card for every run of three or more, 4 for a flush in your hand (5 if the starter matches) and 1 for his nobs, a jack of the starter's suit. The calculator above lists every one of these for you.
What is the highest possible cribbage hand?
29. You need three 5s and the jack of the fourth suit, then the fourth 5 is cut as the starter. That's eight fifteens (16), four of a kind (12) and his nobs (1). Only 4 of the 12,994,800 possible hand and starter combinations score 29.
Why is 19 impossible in cribbage?
No mix of five cards adds up to exactly 19 points, and the same goes for 25, 26 and 27. We checked all 12,994,800 combinations to be sure. High scores come in big lumps, such as 6 for three of a kind or 12 for a double double run, so the totals jump over those numbers. That's why players say "nineteen" when a hand scores nothing.
What is his nobs in cribbage?
His nobs is 1 point for holding the jack of the same suit as the starter card. It counts in the crib too. If the starter itself is a jack, that's his heels instead: the dealer pegs 2 straight away, and it isn't part of anyone's hand.
Does a flush count in the crib?
Only if all five cards are the same suit: the four crib cards and the starter. That scores 5. In your own hand, four cards of one suit score 4, plus 1 if the starter matches. Turn on the Crib hand switch and the calculator applies the right rule.
Which cards should I throw into the crib?
Switch to "Which cards to keep" and enter your six cards. It tries all 15 ways of keeping four against all 46 possible starters, adds an estimate of what your two cards are worth in the crib, and ranks the choices for your crib and for theirs. As a rule of thumb, throw 5s and pairs into your own crib, and avoid giving your opponent 5s.
Is this cribbage calculator free?
Yes. There's nothing to sign up for, no adverts inside the calculator and nothing to install. It works in your browser on a phone, tablet or computer, and the cards you enter never leave your device.
Twist it into something else
Once your calculator counts hands correctly, the same scoring code can power all sorts of things. Change a prompt to make:
A pegging board score tracker
a cribbage board drawn on screen with two or three coloured pegs that leapfrog along 121 holes, with +1, +2 and +hand buttons, an undo, and "skunk" lines at 91 and 61
"What's this hand worth?" quiz
deal a random hand and starter, type in your count, and see the breakdown of anything you missed. Keep a streak, and add a timer for practice before a club night
A printable scoring cheat sheet
one A4 or US Letter page with the scoring rules, example hands, the 29 hand and the ways to make 15, sized to sit in the box with the board
A muggins game for two
both players type in what they think their hand is worth, and the page awards any points they missed to the other player, as in the old "muggins" rule
Counting by checking everything
People count a cribbage hand by spotting patterns, which is why they miss things. The calculator doesn't spot anything: it checks every possibility. Five cards can be grouped in 31 ways (every card in or out, minus the empty group), so it adds up each group and gives 2 points to every one that makes 15. For pairs, it looks at all 10 ways of picking two cards. For runs, it lines the ranks up from ace to king, finds the longest unbroken stretch of three or more, and multiplies its length by the number of ways to pick one card from each rank. That's how 3-4-4-5 becomes two runs of 3 without any special rule.
The "which cards to keep" helper is the same idea on a bigger scale. Six cards give 15 ways to keep four. Each is scored with all 46 cards that could be cut, which is 690 hands. For the crib, it scores your two cards with every possible starter and every pair of cards your opponent might throw: about 45,000 crib hands for each choice, or nearly 700,000 in all. A phone does that in well under a second, which is why the scoring code is written to be quick.
Building it yourself is a lovely way to see how a computer turns rules into answers. It's one small file with no sign-ups and nothing uploaded, and you can change it however you like, from your family's house rules to a quiz for the cribbage club.