Magic square puzzle

Fill the empty cells so that every row, column and both diagonals add up to the magic constant. Each puzzle has exactly one answer, and the lines are checked as you type.

Last updated · Method and sources below

Play the puzzle

Magic constant for this order: 15

A whole number from 1 to 7. More blanks make a harder puzzle.

0 to 999999. Leave it empty for a random puzzle, or enter a number again later to get the same puzzle.

Your grid
Puzzle grid. Bold numbers are given.

Whole numbers from 1 to 9, each used once.

Puzzle number:

How this is calculated

A normal magic square uses the numbers 1 to n² once each, and every line equals

M = n(n² + 1) / 2

That is 15 for 3 × 3 and 34 for 4 × 4. A grid has 2n + 2 lines: n rows, n columns and 2 diagonals. The figure above counts the lines that are completely filled and add up to M. A line with a blank does not count yet.

Each puzzle starts from a magic square, then clears some cells. The cleared cells are chosen so that their rows and columns let you work out every missing number, which is why each puzzle has exactly one answer. The page checks this with the same solver as the magic square solver.

Rules and limits

Three solving tips

  1. Use the constant. Any line with one blank gives the missing number: M minus the sum of the others.
  2. Look for lines with a single blank first, then repeat; each filled cell can unlock another line.
  3. In a 3 × 3 square the centre is always 5. The 3 × 3 magic square guide shows why. The 4 × 4 guide covers the larger grid.

Playing with the keyboard

Press Tab to move from cell to cell and type a number. Press Enter in any field to check the grid. The Hint button fills in one correct cell and locks it. It is placed on the first cell, reading left to right and top to bottom, that does not match the answer.

Sources

  1. Weisstein, Eric W. “Magic Square.” MathWorld, A Wolfram Resource. mathworld.wolfram.com/MagicSquare.html (constant formula).

The magic square worksheets page makes printable sheets with an answer page. To build a full square from scratch, use the magic square generator.

Report an error