Skip to the game
Tic Tac Toe

Hex

Join your two sides of the board with a chain of stones in this Hex game, against a three-level computer or a friend, on boards from 7×7 to 11×11.

Play Hex

You
0
Computer
0

Setting up the board…

Tap an empty hexagon to place a stone. Red wins by joining the top and bottom edges with a chain of red stones; Blue wins by joining left and right. Someone always wins. With a keyboard, move with the arrow keys and press Enter; H gives a hint, U undoes, and N starts a new game.

Game settings
Changing a setting starts a new game. Each opponent keeps its own score.
Opponent
Difficulty
You play
Board
Swap rule

How it works

How to play the Hex game

Place one stone a turn on any empty hexagon, and be the first to link your two edges of the board with an unbroken chain.

  1. Step 01

    Place a stone

    Tap any empty hexagon. Red always moves first, and stones never move once they're down.
  2. Step 03

    Block and connect

    A wall that stops your opponent is part of your own chain. The first chain across wins, and there are no draws.

Features

Hex with the swap rule and three board sizes

  • Levels that play out random games

    Easy plays loosely, Medium blocks one-move wins, and Hard plays out thousands of random games and guards its bridges.

  • Red against Blue on one screen

    Red and Blue take turns on the same screen, with their own scoreboard.

  • 7×7, 9×9, or 11×11

    A quick 7×7, the 9×9 default, or the traditional 11×11 board.

  • Swap rule

    Turn it on and Blue may take over Red's first stone, which keeps strong openings in check.

  • A hint from Hard, and undo

    A hint shows where Hard would play, or suggests a swap. Undo takes a move back.

  • Arrow keys and named hexagons

    Move with the arrow keys, place with Enter, and hear every hexagon named, like e5, empty.

Strategy

Hex strategy: bridges, edges, and blocking

Hex rewards thinking about connections, not single stones. These ideas come from the game's simplest patterns.

  • Start near the center

    A central stone can reach both of your edges and gets in the way of both of your opponent's. With the swap rule on, open a little off center instead.

  • Use bridges

    Two of your stones with two empty hexagons between them form a bridge. If your opponent takes one gap, take the other and they stay linked.

  • Reach the edge from the second row

    A stone on the second row from your edge, with the two hexagons between it and the edge empty, is as good as connected. Answer a block on one with the other.

  • Block from a distance

    A block right next to an enemy stone is easy to walk around. Block a few hexagons ahead, where your stone also helps you.

  • Every block is a connection

    As Piet Hein put it, a barrier for your opponent is a connection for you. Look for moves that do both.

  • Mind the swap

    With the swap rule on, Medium and Hard take over any first stone close to the center. Open with something good, but not too good.

About the game

The Hex game: a connection game with no draws

The rules, why there are no draws, boards and the swap rule, the computer levels, controls, tips, and the story of Piet Hein and John Nash.

Hex is a two-player connection game on a diamond-shaped board of hexagons. Red tries to join the top and bottom edges, Blue the left and right, and one of them always succeeds. Here you play a three-level computer or a friend on the same screen, on boards from 7×7 to the traditional 11×11.

Hex game rules: join your two sides

The board is a rhombus of hexagons with red edges at the top and bottom and blue edges on the left and right. Red moves first. On your turn, place one stone of your color on any empty hexagon. Stones never move and are never captured.

Red wins with an unbroken chain of red stones from the top edge to the bottom, and Blue by joining left and right. Two hexagons are linked when they share a side, so a chain can bend and wander as much as it likes, and a corner hexagon counts for both edges it touches. When a chain is complete, the game ends and the winning chain lights up.

Why a Hex game can never end in a draw

Hex has no draws, and that's not a house rule: a full board always has exactly one winning chain. Picture a full board and look at every red stone linked to the top edge. Either that group reaches the bottom, and Red has won, or it doesn't. If it doesn't, the blue stones along its lower border touch one another from the left edge to the right, and Blue has won.

It works because hexagons meet only along whole sides, never at a single point, so two chains can't cross. On a grid of squares, which can touch at just a corner, chains could cross or both get stuck. Piet Hein designed the game around this.

Board sizes, colors, and the swap rule

Under Board, choose 7×7 for a quick game, 9×9, the default, or 11×11, the traditional size. Against the computer, You play sets your color: Red moves first, Blue second.

Moving first is a big advantage in Hex, so serious games use the swap rule, also called the pie rule. Turn it on and, after Red's first stone, Blue may press Swap: take that stone instead of placing one. The stone turns blue and moves to its mirror image across the long diagonal, so a red stone on c2 becomes a blue stone on b3, in the same spot relative to Blue's edges. Then Red plays again, so Red gains nothing by opening too strong.

How the computer picks a hexagon

Under Opponent, play the computer, or choose 2 players to share one screen as Red and Blue. The computer fills the rest of the board at random many times and counts which empty hexagons tend to end up with the winner. The levels differ in how hard they look:

  • Easy uses 40 random fill-ins a move, plays anywhere about one move in four, and doesn't block a chain one stone from winning.
  • Medium takes a winning hexagon when it has one, blocks yours, and uses 400 fill-ins. With the swap rule off, it opens in the center.
  • Hard does all that, mends a bridge as soon as you cut into it, uses 3,000 smarter fill-ins, then checks its 10 best moves with 400 more each.

With the swap rule on, Medium and Hard take over any first stone within 2 steps of the center on 7×7, or 3 on the bigger boards, and Easy swaps about 3 times in 10.

Hexagon names, taps, and keyboard play

Tap or click an empty hexagon to place a stone. Columns are lettered from a along the top and rows numbered down the side, so every hexagon has a name like e5, and a small dot marks the last stone played.

  • Keyboard: Tab to the board, move with the arrow keys, and press Enter to place a stone. H shows a hint, U undoes, N starts a new game, and Escape closes the result card.
  • Screen readers: each hexagon is read out with its name and what's on it, such as e5, empty, and every move is announced.
  • Hint and Undo: a hint shows where Hard would play, or suggests a swap. Undo takes back your last move, and against the computer its reply too.

Bridges, ladders, and other habits

  • Learn on 7×7, where a game takes a few minutes and mistakes are easy to see.
  • Play near the middle early and leave the edges for later.
  • When your opponent cuts into a bridge, answer in the other gap right away. Hard does it every time unless it has a win to take or a win to block first.
  • Avoid ladders. If you push along the second row from your edge while your opponent blocks along the edge row, each stone you add stays one row short. A ladder only helps you if a stone of yours further along that row is waiting to catch it.
  • Watch both ends of your opponent's chain, not just the stone they just placed.
  • Turn on the swap rule against Hard and try openings at different distances from the center to see which ones it takes over.

Who wins the Hex game? Strategy stealing

Since Hex can't be drawn, one player must have a winning strategy, and it's the first player. The proof, credited to John Nash, is called strategy stealing. Suppose the second player had a winning plan. The first player could place one stone anywhere, then follow that plan as if moving second, placing a spare stone whenever the plan points at a hexagon they already hold. An extra stone never hurts in Hex, so the first player would win, which is impossible. So the first player has the winning plan.

Like the proof for Chomp, it doesn't say how to win, which is why the swap rule exists.

Piet Hein, John Nash, and Parker Brothers

The Danish mathematician and poet Piet Hein introduced the game in 1942 at the Niels Bohr Institute in Copenhagen. It first appeared in print as Polygon in the newspaper Politiken on 26 December 1942, sold on pads of 11×11 boards for pencil play.

In 1948 or 1949, John Nash, then a graduate student at Princeton, came up with the game again, independently as he always insisted, and players there called it Nash. Parker Brothers sold it as Hex from 1952, and that name stuck. Martin Gardner wrote about it in his Scientific American column in 1957.

Hex, mathematics, and computers

Hex keeps turning up in mathematics. In 1979 David Gale showed that its no-draw property is equivalent to the Brouwer fixed-point theorem, a well-known result in topology. In 1981 Stefan Reisch proved that judging an arbitrary Hex position is PSPACE-complete, which means no fast general method for it is expected to exist. Around 1950, Claude Shannon and E. F. Moore even built a Hex machine out of resistors and light bulbs.

Small boards have been solved by computer. An explicit first-player strategy for 7×7 was published in 2002, every opening on 8×8 was solved in 2009, and every opening on 9×9 in 2013. Boards from 10×10 up haven't been fully solved, so on 11×11 everyone knows Red can win, but not how.

Leaving an 11×11 game halfway

No account is needed. The page needs a connection to load. After that, Hard's thousands of random fill-ins run in your browser, and your moves and scores aren't sent to a server.

Your settings, a score for each opponent, and the stones on the board right now are kept in this browser's local storage, so an 11×11 game you leave halfway is still there when you return. Reset scores clears the scores, and the privacy policy lists the rest. For another game of placing stones, try Gomoku.

FAQ

Hex questions

Quick answers about playing the Hex game: the rules, draws, the swap rule, bridges, the computer, and saving.

How do you play the Hex game?

Take turns placing a stone on any empty hexagon. Red moves first and wins by joining the top and bottom edges with a chain of red stones. Blue wins by joining the left and right edges.

Can Hex end in a draw?

No. However the board fills up, exactly one player ends up with a chain between their edges, so every game has a winner.

Does the first player have an advantage in Hex?

Yes. With perfect play the first player can always win, though nobody knows how on big boards. That's why the swap rule exists: Blue may take over Red's first stone instead of placing one.

How does the swap rule work here?

Turn on Swap rule in the settings. After Red's first stone, Blue can press Swap: take that stone. The stone turns blue and moves to its mirror image across the long diagonal, and Red plays next.

What is a bridge in Hex?

Two of your stones that don't touch but share two empty neighbors. If your opponent takes one of the two, take the other, and your stones stay linked.

How does the computer choose its moves?

It fills the rest of the board at random many times and picks the hexagon that most often ends up winning: 40 times a move on Easy, 400 on Medium, and thousands on Hard. Medium and Hard also block one-move wins.

What board size should I use?

7×7 is quick and good for learning, 9×9 is the default, and 11×11 is the traditional size for serious games.

Can two people play Hex on one device?

Yes. Pick 2 players under Opponent and pass the device between Red and Blue. Red moves first, and the swap rule works in 2-player games too.

Who invented Hex?

Piet Hein introduced it in Denmark in 1942 as Polygon. John Nash came up with it again at Princeton in 1948 or 1949, and Parker Brothers sold it as Hex from 1952.