How do you make a 3 × 3 magic square?
- Draw a 3 × 3 grid for the magic square and use the numbers 1 to 9 once each.
- Put 5, the middle number, in the center cell.
- Put the even numbers 2, 4, 6 and 8 in the corners, with opposite corners adding to 10.
- Fill each remaining cell so its row or column adds to 15.
- Check all three rows, all three columns and both diagonals.
A magic square only works when every line adds to the same total, so step 5 matters as much as the others. For a 3 × 3 magic square made from 1 to 9, that total, called the magic sum, is always 15. To solve a magic square puzzle with some numbers already filled in, find the magic sum first (from any full line, or 3 × the center in a 3 × 3), then complete any line with only one gap.
Example
Put 5 in the center. Put 2 in the top right corner and 8 in the opposite corner, bottom left. Put 4 top left and 6 bottom right.
The top row is 4, ?, 2, so the gap must be 9. The bottom row is 8, ?, 6, so the gap is 1.
The left column is 4, ?, 8, so the gap is 3, and the right column is 2, ?, 6, so the gap is 7.
The finished square has the rows 4 9 2, 3 5 7 and 8 1 6. Every row, column and diagonal adds to 15, for example 4 + 5 + 6 = 15 and 9 + 5 + 1 = 15.
This square has been known in China for centuries, where it is called the Lo Shu, and it is a good first magic square to show children. Every other 3 × 3 magic square that uses 1 to 9 is the Lo Shu turned or flipped, which gives 8 versions in all.
What is the magic square formula?
The magic square formula gives the magic sum, also called the magic constant. It is n(n² + 1) ÷ 2, where n is the number of cells along one side. It works for any magic square that uses each number from 1 to n² once, called a normal magic square.
Example
For a 3 × 3 square, n = 3. The formula adds all the numbers in the grid and shares that total equally among the n rows. The numbers 1 to 9 add to 45, and there are 3 rows, so each row adds to 45 ÷ 3 = 15. The formula gives the same thing: 3 × (9 + 1) ÷ 2 = 3 × 10 ÷ 2 = 15.
- 3 × 3 square: magic sum 15
- 4 × 4 square: magic sum 34
- 5 × 5 square: magic sum 65
- 6 × 6 square: magic sum 111
There is no 2 × 2 magic square, so the formula is used from 3 × 3 up.
Knowing the magic sum first saves time. Without it, learners have to guess and move numbers around. With the target known, each choice can be checked right away.
Why does 5 go in the center?
The center cell belongs to four lines: the middle row, the middle column and both diagonals. Those four lines add to 4 × 15 = 60. Together they cover every cell once, plus the center three extra times.
So 60 = 45 + 3 × center, which makes the center 15 ÷ 3 = 5.
Example
The four lines through the center add to 60. All nine numbers add to 45. The difference, 60 − 45 = 15, is the center counted three extra times, so the center is 5.
This short proof is a good classroom moment. Many learners guess that 5 goes in the middle because it is the middle number. That guess is right, but the proof shows why. The same reasoning shows that in any 3 × 3 magic square, the center is one third of the magic sum.
A similar argument shows why the corners are even. If 1 sat in a corner, its row, its column and its diagonal would each need two other numbers that add to 14.
Those three lines share only the corner, so they need three different pairs. Only two pairs from 2 to 9 add to 14 (5 + 9 and 6 + 8), so one line is always left without a pair. The same check rules out 3, 7 and 9 as corners, so the odd numbers end up in the middle of each side.
How do you make a magic square of any odd size?
- Put 1 in the middle cell of the top row.
- Move one cell up and one cell to the right to place each next number.
- Wrap around to the bottom row if you leave the grid at the top.
- Wrap around to the left column if you leave the grid on the right.
- Put the number directly below the last number instead if that cell is already taken.
- Repeat until the grid is full.
This method is often called the Siamese method, or de la Loubère's method. It works for 3 × 3, 5 × 5, 7 × 7 and every other odd size, but not for even sizes.
Example
For a 5 × 5 square, start with 1 in the middle of the top row. Going up from there leaves the grid, so 2 wraps to the bottom row, one column to the right. The numbers climb diagonally until a cell is taken, then move down one cell.
The finished square has the rows 17 24 1 8 15, 23 5 7 14 16, 4 6 13 20 22, 10 12 19 21 3 and 11 18 25 2 9. Every row, column and diagonal adds to 65.
The same steps on a 3 × 3 grid give the rows 8 1 6, 3 5 7 and 4 9 2. That is the Lo Shu again, flipped top to bottom.
How do you make a 4 × 4 magic square?
- Write the numbers 1 to 16 in order, four to a row.
- Find the cells on the two diagonals.
- Replace each diagonal number with 17 minus that number.
- Leave every other number where it is.
- Check that every line adds to 34.
This method works for 4 × 4. Larger sizes that are multiples of 4, such as 8 × 8, use the same idea on the diagonals of every 4 × 4 block, swapping each number for n² + 1 minus that number. Sizes like 6 × 6 need a different method.
Example
In order, the first row is 1 2 3 4. The numbers 1 and 4 are on the diagonals, so they become 16 and 13. The finished square has the rows 16 2 3 13, 5 11 10 8, 9 7 6 12 and 4 14 15 1. Every row, column and diagonal adds to 34.

A famous 4 × 4 magic square appears in Albrecht Dürer's 1514 engraving Melencolia I. Its rows are 16 3 2 13, 5 10 11 8, 9 6 7 12 and 4 15 14 1, which is the square above with the two middle columns swapped. The bottom row shows 15 and 14 side by side, the year of the engraving.
How can you use magic squares in the classroom?
A magic square puzzle works as a short starter or as a puzzle station. It gives a lot of addition practice, and children can check each finished square line by line. Everyone can start, and the stronger learners can go much further.
- Ages 7 to 8: give a 3 × 3 square with five numbers filled in, and ask for the missing four.
- Ages 8 to 10: give only the center 5, the magic sum 15 and the numbers 1 to 9, and ask for a full square.
- Ages 10 to 12: ask why the center must be 5, or build a 5 × 5 square with the Siamese method.
- Ages 12 to 14: use negative numbers, fractions or algebra, such as a square with x in some of the cells.
Example
Give a class the Lo Shu and ask what happens if they add 10 to every number. The new square has the rows 14 19 12, 13 15 17 and 18 11 16, and every line adds to 45.
Then ask them to double every number in the Lo Shu instead. Every line now adds to 30. Learners see that a magic square stays magic when you add the same number to every cell, or multiply every cell by the same number, and they can explain why.
A good question to ask often is "How do you know?" A child who says "It works" has checked one square. A child who explains the center 5 or the magic sum has found a rule.
How do magic squares build mental math?
A magic square asks for the same kind of addition again and again. Each time, children add three or four numbers in their head and compare the result with a target. If a total is too big or too small, they adjust, and each check is a small piece of mental math practice.
Example
In the row 8, 1, 6, a quick way to add is 8 + 6 = 14, then 14 + 1 = 15. Looking for pairs that are easy to add first, such as numbers that make 10, speeds up every check.
For more practice adding several numbers at speed, the addition game turns sums into attacks in a Math Max fight, with a level that gives three numbers at once. That is the same skill a magic square row checks, only faster.

The answer is 195, because 79 + 94 = 173 and 173 + 22 = 195.
For more puzzles of this kind, sorted by age and with answers, see the collection of math puzzles for kids. Magic squares work well alongside number patterns and missing-sign puzzles.
Start with the magic sum, then ask why
Find the magic sum first with n(n² + 1) ÷ 2. For a 3 × 3 square, put 5 in the center and the even numbers in the corners.
For odd sizes, move up and to the right. For 4 × 4, replace the diagonal numbers with 17 minus each one. Then ask your learners to explain why each rule works.
Train these next
