Magic Square
Runs entirely on your device โ works with the network off, no ads, no account, no tracking.
- Works offline
- Keyboard playable
- Screen-reader playable
- No ads, no account
- No betting, no money, no prizes
- 2โ5 minAll ages
How do you solve a 4x4 magic square?
Never by trying numbers. Work the line with the fewest holes, and start with any line that has only one. That cell is forced: the line has to make 34, so it wants 34 minus what it already holds, and there is exactly one number that can go there. Fill it, and notice that the cell you just filled sits on a column and possibly a diagonal too โ each of those lines is now one hole closer, and often one of them has just dropped to its last hole as well. Repeat and a board that looked like a search collapses into a chain. When the chain stalls, move to a line with two holes: it tells you what its pair must add to, so you can find candidate pairs in the tray, and then a line crossing those two cells decides which of the pair goes where. That is the whole method, and it is the same idea constraint solvers call unit propagation โ do every move that is forced before you consider any move that is not.
8 to place, 6 tries left. Holding 3. Cursor at row 1, column 2: empty. This row needs 16 across 2 cells; this column needs 11 across 2 cells.
Column 1 has one hole left, so it is forced: it holds 28 and 34 โ 28 = 6. That is the whole technique โ find the line with one hole and read the number off it.
โ โ โ โ (or W A S D) move the cursor ยท F or Shift holds the next number in the tray, Esc or Z the previous one ยท Enter or Space puts the held number in. Or click a cell, then click a number. A wrong number is refused and costs one try; moving and choosing cost nothing. Click the board first, or press Tab to focus it.
What this builds
SKILL โ finish the line that is closest to forced, instead of the one that looks emptiest
Sixteen numbers, ten lines, one sum
A four-by-four grid, the numbers 1 to 16 used once each, and one rule: every row, every column and both diagonals add to 34. Eight cells are dealt to you and eight are holes; the eight missing numbers sit in a tray under the board, and your job is to put each one where it belongs.
The board does the arithmetic out loud. Beside every row, under every column and next to each diagonal is a live reading: what that line already holds, what it still needs, and across how many cells. A line down to its last hole is marked โ it is forced, because it can only want the target minus what it already has. That one habit solves most of the board, and the readings are there so you can discover it rather than be told it.
A number that does not belong is refused rather than written, so the grid can never be driven into a state with no answer. The only cost of a guess is one of your tries, and when they run out the round ends.
It runs entirely on your device: 0 network requests, works offline. No ads, no account, nothing to buy, and no betting, money or prizes of any kind.
How to play
- Focus the board โ click it, or press Tab until it is focused.
- Move the cursor with the arrow keys, or W A S D. It opens on the first hole. Moving costs nothing, so look around as much as you like.
- Hold a number from the tray with F (or Shift); Esc or Z steps back the other way. The tray is a ring, so one key reaches every number in it. Choosing costs nothing either.
- Press Enter or Space to put the held number into the cell under the cursor. If it belongs there it goes in, the tray loses it, and the cursor moves to the next hole. If it does not, it is refused, the cell keeps its โ with the refused number under it, and you spend one try.
- Or use the mouse: click a cell to move there, then click a number in the tray to put it in. One click is one move โ clicking a cell never places anything, so you can never spend a try just by looking.
- Read the line beside each row and under each column. The big number is what that line still needs; the small one is how many cells it has to spread it across. in 1 means forced โ that number goes in that cell, and nothing else can.
- Fill all eight holes before the tries run out. Spare tries are worth points, and so is how much of the board needed real reasoning rather than pure counting.
FAQ
How do you solve a 4x4 magic square?
Never by trying numbers. Work the line with the fewest holes, and start with any line that has only one. That cell is forced: the line has to make 34, so it wants 34 minus what it already holds, and there is exactly one number that can go there. Fill it, and notice that the cell you just filled sits on a column and possibly a diagonal too โ each of those lines is now one hole closer, and often one of them has just dropped to its last hole as well. Repeat and a board that looked like a search collapses into a chain. When the chain stalls, move to a line with two holes: it tells you what its pair must add to, so you can find candidate pairs in the tray, and then a line crossing those two cells decides which of the pair goes where. That is the whole method, and it is the same idea constraint solvers call unit propagation โ do every move that is forced before you consider any move that is not.
Why is the target always 34?
Because it cannot be anything else. The numbers 1 to 16 add to 136, and the four rows between them use every number exactly once, so the four row totals also add to 136. The rows all have to be equal, so each is 136 รท 4 = 34. The same argument fixes the sum for any size: n(nยฒ + 1) รท 2, which gives 15 for a three-by-three and 65 for a five-by-five. The target is a fact about the numbers, not a choice the game made.
Is there always exactly one answer?
Yes, and it is proved rather than assumed. Each board starts as a complete magic square, built โ never searched โ from a pair of Euler's orthogonal Latin squares, which is what guarantees both the sums and that each of 1 to 16 appears once. Holes are then punched one at a time, and a hole is kept only if a solver that counts completions and stops the moment it finds a second still says one. A hole that would allow a second arrangement is put back. Every board also keeps at least one line down to its last hole, so there is always a provable first move waiting for you.
Why is a wrong number refused instead of written into the grid?
Because being told twenty moves later is not feedback, it is a punishment. If wrong numbers could be written, a board could be driven into a state with no completion at all, and the only cure would be undoing a chain of moves you no longer remember making. Refusing the entry means every number on the board is part of the real answer, the puzzle can never dead-end, and the cost of a guess is one visible, finite try. It also changes what the game rewards: not careful transcription, but working out which cell is forced before you touch anything.
What happens when the tries run out?
The round ends and the answer is written into the holes you never reached, marked answer. How many tries you get is worked out from the board rather than picked: a solver runs the forced chain over the deal, and you get two tries plus one for every hole the chain cannot reach on its own, between three and six. So a board that falls out entirely by counting gives you three, and a board with real decisions on it gives you six. Moving the cursor and changing which number you hold are both free and unlimited.
Is there any money, betting or in-app purchase in this?
None, and there never will be. No currency, nothing to buy, no hints to unlock for a fee, no prizes.
Does it work offline?
Yes. Once the page has loaded once, the whole game โ the board, the generator and the solver that proves the answer is the only one โ is on your device. No server is involved in play at any point.
Can I play it with a keyboard or a screen reader?
Both. Arrows or W A S D move, F or Shift holds the next number, Esc or Z the previous one, and Enter or Space puts it in. Every cell announces what it holds in words โ empty, dealt 12, your 7 โ and every line announces what it holds and what it still needs across how many cells. A dealt cell says dealt, one you placed says yours, a refused entry says which number was refused, and a complete line carries โ while a forced one carries โ, so nothing on this board depends on telling two colours apart.
Limits
Four by four, eight holes, and the numbers 1 to 16. There are 7 040 magic squares of this size in total; the construction here reaches 4 608 relabellings and rotations of one orthogonal pair, which is far more than anyone will see, and the deal on top of it is different every time. Uniqueness is checked exhaustively when the board is dealt rather than estimated โ eight holes is small enough for the counting solver to finish in well under a millisecond, which is exactly what the eight-hole cap buys. Boards are rated chained, steady or wide by how many holes the forced chain cannot reach, and the try budget follows the same number. There is no timer, no streak to protect and no daily limit.
Related
Mini Sudoku is the other grid where a wrong entry is refused the moment it is made, and where the move to look for is the cell with only one candidate left. Sum Links and Pair Sums drill the same arithmetic from the other direction โ given a target, find the numbers โ while Gap Logic runs the identical "do every forced move first" habit over an ordering instead of a grid.
Bookmark this page (Ctrl+D, or โD on Mac) or install the app โ it works offline the next time you need it.
Have a question or feedback about this game?
Private: this note isn't tracked, and nothing you did in this game is sent โ only what you type here.