All games

How to Solve a Magic Square

Find the magic sum and the center first. The rest fills in by subtraction.

Play Magic Square (free)

Solve it in 3 steps

  1. Magic sum: add all the numbers and divide by the number of rows (15 for 1 to 9)
  2. Center of a 3×3: the magic sum ÷ 3 (always 5 for 1 to 9)
  3. Lines with one empty square (rows, columns, diagonals): fill in by subtraction

A 3×3 with some numbers: fill lines with one gap first

Puzzle

  1. Use each of 1 to 9 once so that every row, column and diagonal has the same total.
  2. Magic sum: 1 to 9 add up to 45. Split over 3 rows: 45 ÷ 3 = 15
  3. Center: the magic sum ÷ 3, so 15 ÷ 3 = 5
  4. Top row: 2 + 7 + □ = 15, so □ = 6
  5. Middle row: □ + 5 + 1 = 15, so □ = 9
  6. Diagonal: 2 + 5 + □ = 15, so □ = 8
  7. Diagonal: 6 + 5 + □ = 15, so □ = 4
  8. Bottom row: 4 + □ + 8 = 15, so □ = 3. Solved!
Try a 3×3 magic square ›

An empty 3×3 with 1 to 9: the center is always 5

Puzzle

  1. Place each of 1 to 9 once in an empty 3×3. The magic sum is 15.
  2. Center: the 4 lines through it add up to 60 = 45 + 3 × center, so it is 5
  3. 9 goes on an edge: a corner 9 uses 1 and 5 on its diagonal, so only 2 + 4 is left to make 6
  4. Opposite the 9: 9 + 5 + □ = 15, so □ = 1
  5. Corners next to the 9: they make 6, so 4 and 2 (either way round)
  6. Diagonals: 15 − 4 − 5 = 6 and 15 − 2 − 5 = 8
  7. Last 2 squares: 3 on the left, 7 on the right. Solved!
Try a 3×3 magic square ›

Even numbers always go in the corners, odd numbers in the middle of the edges.

A 4×4: the magic sum is 34, then fill lines with one gap

Puzzle

  1. The square in Albrecht Dürer’s 1514 engraving Melencolia I. Use 1 to 16 once each.
  2. Magic sum: 1 to 16 add up to 136. Split over 4 rows: 136 ÷ 4 = 34
  3. Top row: 16 + 3 + 2 + □ = 34, so □ = 13
  4. Left column: 16 + 5 + □ + 4 = 34, so □ = 9
  5. Diagonal: 13 + □ + 6 + 4 = 34, so □ = 11
  6. Second row: 5 + □ + 11 + 8 = 34, so □ = 10
  7. Diagonal: 16 + 10 + 7 + □ = 34, so □ = 1
  8. Bottom row: 4 + □ + 14 + 1 = 34, so □ = 15. Solved!
Try a 4×4 magic square ›

Negative numbers: the center is the average of opposite squares

Puzzle

  1. Only −3, 1 and 3 are given. Make every row, column and diagonal add up the same.
  2. Center: the average of the opposite −3 and 3 is 0, so the magic sum is 0 × 3 = 0
  3. Top row: −3 + □ + 1 = 0, so □ = 2
  4. Diagonal: 1 + 0 + □ = 0, so □ = −1
  5. Left column: −3 + □ + (−1) = 0, so □ = 4
  6. Right column: 1 + □ + 3 = 0, so □ = −4
  7. Bottom row: −1 + □ + 3 = 0, so □ = −2. Solved!
Try the 1 to 9 magic square ›

Tips and tricks for solving magic squares

Magic square practice puzzles (with answers)

Puzzles 1 and 2 use whole numbers, and puzzle 3 uses negative numbers.

8
5
9
Puzzle 1: use 1 to 9
38
2
Puzzle 2: use 2 to 10
−1
2
3
Puzzle 3: use −4 to 4
Show the answers

The colored numbers are the ones given in the puzzle.

816
357
492
Puzzle 1: magic sum 15. Start with the middle column to get 1
387
1062
549
Puzzle 2: the total is 54, so the magic sum is 54 ÷ 3 = 18 and the center is 6
−14−3
−202
3−41
Puzzle 3: magic sum 0, center 0

FAQ

What is the magic sum (magic constant)?
The total of each line: n(n² + 1) ÷ 2 for 1 to n². That is 15 for 3×3, 34 for 4×4 and 65 for 5×5
What number goes in the middle of a 3×3 magic square?
5 with 1 to 9. With other numbers, the center is always the magic sum ÷ 3
How many 3×3 magic squares are there?
With 1 to 9, just 1 if rotations and reflections count as the same. Otherwise 8
How do I find the magic sum without knowing all the numbers?
Add up a full line. In a 3×3 you can also multiply the center by 3
What is the rule for a 4×4 magic square?
With 1 to 16, every line, the four corners and the four center squares add up to 34
How do I make my own magic square?
4×4 and odd sizes like 5×5 have simple methods: see how to make a magic square
Where can I practice?
Here, for free: 3×3 to 5×5 with line totals shown and a Hint button
Play Magic Square (free)