Skip to main content

How to Win the Matchstick Game (15 Sticks or Nim)

Rik is an engineer who has held a range of marketing, technical support, and management roles. He is also a qualified teacher.

Learn how to play 15 sticks and never lose!

Learn how to play 15 sticks and never lose!

Learn How to Win the 15 Sticks Game

The matchstick game, also known as 15 sticks or Nim, is a simple game for two people that you can always win—unless your opponent also knows the secret! It’s a tremendous confidence booster for children who can easily defeat adults after they learn the trick. Kids love secrets, particularly ones adults don't know.

The rules for this game are simple, as is the trick. Let's learn how to do it!

How to Play the Matchstick Game

  1. Start off with 15 matches laid out on the ground. (Even though it's called the "matchstick game," in practice, you can use any small objects. Stones or shells are ideal, which means it is a great game to play on the beach when the kids are getting restless.)
  2. Each person takes turns to remove either 1, 2 or 3 matches.
  3. You win if your opponent is left with the last match.

Example Game of Nim

This is a sample of how to play a winning round of 15 sticks.

Number of MatchesMatches RemovedMatches Left


You remove 2.



Opponent removes 3.



You remove 1.



Opponent removes 2.



You remove 2.



Opponent removes 1.



You remove 3.

1—opponent loses!

So How Does the Math Work?

When you start, you first remove 2 matches. You are then guaranteed to win, if you follow the rest of the process correctly!

From then on, you must remove matches based on what your opponent does, ensuring that 4 matches are removed from the game each round. For example:

  • If they take 1 match, you take 3 matches.
  • If they take 2 matches, you take 2 matches.
  • If they take 3 matches, you take 1 match.

As long as a total of 4 matches are removed each round, your opponent will always be left with the last match.

Target Numbers

The key to this game is target numbers. You arrange it so you leave your opponent with 13, 9, 5 and finally 1 match.

Remember your target numbers for 15 sticks: 13, 9, 5, 1—you win!

Remember your target numbers for 15 sticks: 13, 9, 5, 1—you win!

Can You Win if Your Opponent Starts?

Yes, you can—unless they understand how to win and begin with 2 (see below for that situation).

  • If they start with 1, you take away another 1, bringing you to your target number of 13.
  • If they start with 3, you remove another 3, resulting in your target number of 9.

What if They Start and Remove 2?

In this case, you should play randomly and try to reach a target number. Here's an example game:

  • Start: 15 matches
  • Opponent removes 2 matches, leaving 13.
  • You remove 2, leaving 11.
  • Opponent removes 1, leaving 10.
  • You can then remove 1, leaving 9—which is a target number! You can now win.

Unless your opponent understands the trick, they are almost certainly going to make a mistake and allow you to reach a target number before the end of the game.

Are There Different Versions of Nim?

Yes! There are many variants on the game of Nim—so if these rules don't sound like the game you're familiar with, you've probably been playing a different variant. Here are some of the most common variant rules in Nim:

  • The game is played with 16 matches rather than 15.
  • The matchsticks are arranged in a pyramid shape consisting of four different rows with 1, 3, 5 and 7 matches.
  • Players are able to remove any number of matches per turn rather than only 1, 2 or 3. However, these matches must all come from the same row.
  • The player who removes the last match wins the game rather than losing it. (This rule is less common than the others.)

Different rules require a different strategy for winning, though there are still tricks that help you win consistently. Check out the video below for an example of how to win some Nim variants.

How to Win Nim With 16 Matches

This video shows how to win a 16-match game of Nim where you can take any number of matches from the same row per turn. The player who takes the last match is the loser in this variant. As you'll see in the video, the target numbers for this variant are 4, 2 and 1.

Games Theory

A simple game like this is an example of what mathematicians call an impartial, two-person game with complete information.

  • Impartial means that rules for moving apply equally to both players. This is unlike chess, for example, which is not impartial because the white player can only move white pieces, and black can only move black pieces.
  • Complete information means that both players know the complete state of the game. A contrasting example is poker, where one player does not know the cards held by the other player(s).

Good Luck Beating Everybody at 15 Sticks!

Now that you've mastered the game, try it out on your friends and children. But remember: Don't use your newfound skills to cheat strangers in bars or pubs to make them buy you drinks. This could be illegal where you live—and besides, you might make some enemies!

© 2008 Rik Ravado


Etienne on October 05, 2015:

Ive been shown a varation of this game where the sticks are in a pyramid. You can take any number of sticks from a row, but only one row. The game starts with 15 sticks as well.

Rik Ravado (author) from England on August 20, 2009:


Well done - your method is more generalised and more suitable if you want to vary the number of matches allowed - thanks for stopping by and adding this!

M1rage on August 20, 2009:

A tactic that applies to the game, doesn't matter how many matches there are:

Makes sure, that after you remove 1-2 or 3 matches, the number of the remaining matches is equal to [ 1 + a number dividable by 4 without remainder].

That is: 1 + X mod 4 = 1

For example let's assume:

X = 12

with the previous equation

1+12 mod 4 = 1

thus in the game you'd have to make sure it's the opponent's turn if the count of remaining matches is 13.

If the game starts with 15 matches, you pick first:

You remove 2, because then what remains is 13:


12 mod 4 = 0

If the game starts with 20, you pick first:

You remove 3, because then what remains is 17:


16 mod 4 = 0

Keep to this, and then the count of matches doesn't matter anymore;)


Rik Ravado (author) from England on July 22, 2009:

To Hubbers: I've updated this Hub using the new TABLE capsule!

Rik Ravado (author) from England on March 30, 2009:

K@ri - Yes kids love a secret that means they can beat adults at a game!

Kari Poulsen from Ohio on March 29, 2009:

I can't wait to try this out with my kids! I may even let them in on the secret. :)

Rik Ravado (author) from England on February 03, 2009:

No it can be adapted to play with more matchsticks or even increase the number of matches you are allowed to remove at a time.

So, for example, you could play it with say 20 matches and allow people to remove up to 4 matches at once.

49er from USA on February 03, 2009:

I think this is a great game. I realize this would mess up the strategy, but is it always played with only 15 matchsticks?

podfree on March 09, 2008:

I like your clear explanation of game theory.

Rik Ravado (author) from England on March 09, 2008:

Diana that sounds great - hope you have some success!

Diana Harvey from Philippines on March 09, 2008:

Hi Rik,

Thank you so much for this Hub.

There are many little kids where I live all hanging aroundthe little bars in hopes that someone will give them a few cents to buy some bread.

Now I will get some shells which are in abundance on our beach and teach them. This will provide some amusement to the bar flys and ensure a loaf of bread for theses kids.

I am now on my way to show them.

Thank you