5x5 Magic Square: Sum 65 and How to Build One
A 5x5 magic square is a grid of the numbers 1 to 25, each used once, in which every row, column and both long diagonals add up to 65. That total comes from M = 5(25 + 1)/2, and the Siamese method below builds a valid square in 25 simple moves.

The 3x3 and 4x4 squares are small enough to study completely. The 5x5 is the first size where that stops being possible, because the number of different squares jumps into the hundreds of millions. So this page does two things: it walks through one construction you can repeat on any odd size, and it explains why nobody hands you a list of 5x5 squares.
Why every line adds to 65
For a normal magic square of order n, the magic constant is M = n(n² + 1)/2 (MathWorld), and Wikipedia lists 65 as the constant for order 5. With n = 5 that is 5 × 26 ÷ 2 = 65.
The reasoning is short. The numbers 1 to 25 add up to 25 × 26 ÷ 2 = 325. Five rows share that total equally, so each row must be 325 ÷ 5 = 65, and the columns and diagonals have to match. The magic constant guide proves the general case and tabulates other sizes, so this page does not repeat that table.
Build a 5x5 magic square with the Siamese method
The Siamese method (also called de la Loubère's method) works for every odd order. Wikipedia dates its description in Europe to 1691, when Simon de la Loubère described the Indian continuous method. The rules fit in three lines:
- Write 1 in the middle cell of the top row.
- Write each next number one cell up and one cell to the right. If that move leaves the grid, wrap around: off the top, reappear at the bottom of the same column; off the right edge, reappear on the left of the same row. If the move leaves at the top-right corner, it wraps to the bottom-left corner. That cell is always already filled, so rule 3 applies.
- If the cell you would move to is already taken, write the next number directly below the one you just placed.
The walk-through below uses eight stages instead of 25 separate clicks, grouping the numbers into runs that follow the same move. Use Next and Back to move between stages. Nothing plays automatically and nothing animates. The caption under each grid explains the moves, and the new cells are bold so you do not have to rely on colour.
Siamese method, 5x5, stage by stage
All eight stages, written out
This is the same walk-through as a plain list. It is what you see without JavaScript, and it is easy to print or follow with a pencil.
Stage 1 of 8: number 1
Stage 1 of 8: numbers 1 to 1 placed. New cells are bold. Row 1 blank blank 1 blank blank Row 2 blank blank blank blank blank Row 3 blank blank blank blank blank Row 4 blank blank blank blank blank Row 5 blank blank blank blank blank Put 1 in the middle of the top row (row 1, column 3).
Stage 2 of 8: numbers 2 to 5
Stage 2 of 8: numbers 1 to 5 placed (new: 2 to 5). New cells are bold. Row 1 blank blank 1 blank blank Row 2 blank 5 blank blank blank Row 3 4 blank blank blank blank Row 4 blank blank blank blank 3 Row 5 blank blank blank 2 blank Move one cell up and one to the right each time. 2 leaves the top edge, so it wraps to the bottom row (row 5, column 4). 3 goes to row 4, column 5. 4 would fall off the right edge, so it wraps to row 3, column 1. 5 goes to row 2, column 2.
Stage 3 of 8: number 6
Stage 3 of 8: numbers 1 to 6 placed. New cells are bold. Row 1 blank blank 1 blank blank Row 2 blank 5 blank blank blank Row 3 4 6 blank blank blank Row 4 blank blank blank blank 3 Row 5 blank blank blank 2 blank From 5, up and right is row 1, column 3, and that holds 1. When the target is taken, drop one cell straight down from the number you just placed instead. 6 goes to row 3, column 2.
Stage 4 of 8: numbers 7 to 10
Stage 4 of 8: numbers 1 to 10 placed (new: 7 to 10). New cells are bold. Row 1 blank blank 1 8 blank Row 2 blank 5 7 blank blank Row 3 4 6 blank blank blank Row 4 10 blank blank blank 3 Row 5 blank blank blank 2 9 Back to up and right. 7 goes to row 2, column 3 and 8 to row 1, column 4. 9 wraps from the top to row 5, column 5. 10 wraps from the right edge to row 4, column 1.
Stage 5 of 8: number 11
Stage 5 of 8: numbers 1 to 11 placed. New cells are bold. Row 1 blank blank 1 8 blank Row 2 blank 5 7 blank blank Row 3 4 6 blank blank blank Row 4 10 blank blank blank 3 Row 5 11 blank blank 2 9 From 10, up and right is row 3, column 2, which holds 6. Drop down: 11 goes to row 5, column 1.
Stage 6 of 8: numbers 12 to 15
Stage 6 of 8: numbers 1 to 15 placed (new: 12 to 15). New cells are bold. Row 1 blank blank 1 8 15 Row 2 blank 5 7 14 blank Row 3 4 6 13 blank blank Row 4 10 12 blank blank 3 Row 5 11 blank blank 2 9 12 goes to row 4, column 2, 13 to row 3, column 3 (the centre), 14 to row 2, column 4 and 15 to row 1, column 5, the top-right corner.
Stage 7 of 8: numbers 16 to 20
Stage 7 of 8: numbers 1 to 20 placed (new: 16 to 20). New cells are bold. Row 1 17 blank 1 8 15 Row 2 blank 5 7 14 16 Row 3 4 6 13 20 blank Row 4 10 12 19 blank 3 Row 5 11 18 blank 2 9 From 15 in the top-right corner, up and right wraps to the bottom-left corner (row 5, column 1), which holds 11. Drop down: 16 goes to row 2, column 5. Then 17 wraps to row 1, column 1, 18 to row 5, column 2, 19 to row 4, column 3 and 20 to row 3, column 4.
Stage 8 of 8: numbers 21 to 25
Stage 8 of 8: numbers 1 to 25 placed (new: 21 to 25). New cells are bold. Row 1 17 24 1 8 15 Row 2 23 5 7 14 16 Row 3 4 6 13 20 22 Row 4 10 12 19 21 3 Row 5 11 18 25 2 9 From 20, up and right is row 2, column 5, which holds 16. Drop down: 21 goes to row 4, column 4. Then 22 goes to row 3, column 5, 23 to row 2, column 1, 24 to row 1, column 2 and 25 to row 5, column 3. The square is full.
Check the finished square
After stage 8 the grid is full. Add every line before trusting it: the table shows the five row sums on the right, the five column sums underneath and the two diagonal sums in the corners.
| Column 1 | Column 2 | Column 3 | Column 4 | Column 5 | Diagonal ↗ sum ↗ 65 | |
|---|---|---|---|---|---|---|
| Row 1 | 17 | 24 | 1 | 8 | 15 | Row 1 sum 65 |
| Row 2 | 23 | 5 | 7 | 14 | 16 | Row 2 sum 65 |
| Row 3 | 4 | 6 | 13 | 20 | 22 | Row 3 sum 65 |
| Row 4 | 10 | 12 | 19 | 21 | 3 | Row 4 sum 65 |
| Row 5 | 11 | 18 | 25 | 2 | 9 | Row 5 sum 65 |
| Column sums | Column 1 sum 65 | Column 2 sum 65 | Column 3 sum 65 | Column 4 sum 65 | Column 5 sum 65 | Diagonal ↘ sum ↘ 65 |
The first row is 17 + 24 + 1 + 8 + 15 = 65, and the main diagonal is 17 + 5 + 13 + 21 + 9 = 65. The other ten lines work out the same way, and the stepper's last stage runs the same check by code.
A slip-catcher
In this square the centre is 13 and every pair of opposite cells adds to 26 (17 and 9, 24 and 2). Other 5x5 magic squares need not have either property, so use them only to catch a slip while building, not to solve a partly filled puzzle.
Why there is no list of 5x5 squares
The 4x4 guide can show every square because there are only 880 of them (Wikipedia). For order 5 the count is 275,305,224 different squares, not counting rotations and reflections (Wikipedia), and MathWorld credits R. Schroeppel with computing it in 1973.
Each of those squares also has rotated and mirrored copies. Counting those separately multiplies the total by 8, which comes to 2,202,441,792 grids. Nobody can browse or print a list that size, and the Siamese square above is one point in it.
The magic square solver covers 3x3 and 4x4 only. For a partly filled 5x5, find a row, column or diagonal with one blank and subtract the other four numbers in that line from 65.
Other sizes
The same rules build any odd-order square. The how to make a magic square guide covers other sizes, and the magic square generator builds squares and checks their lines.
Method and sources
The Siamese 5x5 grid and its stages come from the same odd-order generator the generator page uses. I checked by code that all twelve lines add to 65, that 1 to 25 each appear once, that the centre is 13 and that every pair of opposite cells adds to 26. The figure shows the same grid, which I compared cell by cell; Wikimedia Commons offers it under CC BY-SA 3.0. The claim that rotations and reflections multiply the count by 8 is arithmetic, not taken from a source.
- Weisstein, Eric W. “Magic Square.” MathWorld, A Wolfram Resource. mathworld.wolfram.com/MagicSquare.html (magic constant formula; the order-5 count and who computed it).
- “Magic square.” Wikipedia. en.wikipedia.org/wiki/Magic_square (275,305,224 squares of order 5 excluding rotations and reflections; constant 65 for order 5; de la Loubère, 1691).