Nim

Take matches, and leave the last one to the computer.

Nim: game details

Category
Strategy
Released
November 2026
Updated
November 2026
Players
1 player, or 2 on the same screen
Levels
3 (Easy, Medium, Hard)
Controls
mouse, touch
Badges
4, from bronze to diamond (up to +185 points)
Platforms
Web browser on computer, phone and tablet
Screen
Portrait and landscape
Technology
HTML5
Price
Free, no download

Tags

More games like this

Nim is one of our strategy games. If you enjoy it, try Tic Tac Toe, Four in a Row or Reversi next.

How to play Nim

  1. A row of matches is laid out. Players take turns.
  2. On your turn, take 1, 2 or 3 matches.
  3. Whoever takes the last match loses.
  4. Play against the computer, or choose 2 players for a game with a friend.

Tips

  • Count backward: leave your opponent exactly 1 match and you win.
  • The magic numbers are 1, 5, 9, 13, 17, 21: try to leave your opponent one of them.
  • If your opponent leaves you a magic number, take just 1 and wait for a mistake.
  • On Hard the computer never errs: only the right strategy wins, and it does every time.
  • On Easy and Medium, and with two players, Undo takes back your last move along with the computer's answer. On Hard, every move counts.

About Nim

Nim is a mathematical game with a long history and a hidden secret: there is a winning strategy, and once you find it, you can win every game you start from a good position.

This is the classic version where taking the last match loses. On Easy and Medium the computer makes mistakes; on Hard it plays perfectly, but you always start from a position you can win.

Points and badges

Finishing a game of Nim earns points for your level. Four badges are waiting in this game, from bronze to diamond: each one says what to do and adds bonus points.

Questions

Is there a way to always win?

Yes: always leave your opponent 1, 5, 9, 13... matches. From the starting position you can always do it.

Can the computer be beaten on Hard?

Yes, with the winning strategy from the very first move.

Can I play with a friend?

Yes. Choose 2 players and take turns on the same screen.