Magic Square Generator
Build a magic square of any order from 3 to 24 using the Siamese, criss-cross and LUX methods, with every row, column and diagonal checked against the magic constant.
Verified: all 5 rows, all 5 columns and both diagonals sum to 65, using each of the numbers 1 to 25 exactly once.
5 × 5 magic square — Siamese (odd order)
| 17 | 24 | 1 | 8 | 15 | 65 |
| 23 | 5 | 7 | 14 | 16 | 65 |
| 4 | 6 | 13 | 20 | 22 | 65 |
| 10 | 12 | 19 | 21 | 3 | 65 |
| 11 | 18 | 25 | 2 | 9 | 65 |
| 65 | 65 | 65 | 65 | 65 |
Three classical constructions cover every order. Odd orders use the Siamese method, stepping up-and-right and wrapping at the edges. Orders divisible by four use the criss-cross rule, complementing the cells on each 4 × 4 block diagonal. The remaining even orders (6, 10, 14 …) use Conway’s LUX method, expanding a smaller odd square into 2 × 2 blocks. Whichever runs, the finished grid is checked against the magic constant n(n²+1)/2 before it is shown to you — and all of it happens in your browser, with nothing uploaded.
What is the Magic Square Generator?
A magic square is a grid holding each of the numbers 1 to n squared exactly once, arranged so every row, every column and both diagonals add up to the same total.
- All three classical constructions: Siamese, criss-cross and LUX
- Every order from 3 to 24, odd, singly even and doubly even
- Rows, columns and both diagonals verified before the grid is shown
- Row and column totals displayed alongside the square
- Diagonals highlighted so the magic constant is easy to check
- Copy as text, or download as CSV or a printable page
How to use the Magic Square Generator
- 1
Set the order to the grid size you want, anywhere from 3 to 24.
- 2
Read the magic constant in the stats row — every line must add up to it.
- 3
Leave the sums checkbox ticked to see each row and column total beside the grid.
- 4
Confirm the green banner says the square passed its own verification.
- 5
Copy the grid as text, or download it as CSV or a printable sheet.
About the Magic Square Generator
A magic square is a grid holding each of the numbers 1 to n squared exactly once, arranged so every row, every column and both diagonals add up to the same total. Pick an order between 3 and 24 and this tool builds one, using whichever of the three classical constructions fits that size.
Odd orders use the Siamese method, stepping up and to the right and wrapping at the edges. Orders divisible by four use the criss-cross rule, complementing the cells on each 4 by 4 block diagonal. The remaining even orders — 6, 10, 14 and so on — use Conway's LUX method, which expands a smaller odd square into 2 by 2 blocks.
Whichever construction runs, the finished grid is checked against the magic constant n(n squared plus 1) divided by 2 before you see it, and the row and column totals are shown alongside so you can confirm it yourself. Everything is computed in your browser, with nothing uploaded.
Frequently asked questions
What is the magic constant of a magic square?
It is the total that every row, column and diagonal must reach, and it is fixed by the size: n times n squared plus one, all divided by two. A 3 by 3 square sums to 15, a 4 by 4 to 34 and a 5 by 5 to 65.
Is there a 2 by 2 magic square?
No, and it is the only size that is impossible. With just the numbers 1 to 4 there is no arrangement where both rows, both columns and both diagonals reach 5, so the order field starts at 3.
What is the Siamese method?
It is the classic construction for odd-sized squares, also called the De la Loubere method. Start at the middle of the top row, place each next number one step up and to the right wrapping around the edges, and drop down a row instead whenever that cell is taken.
Why do 6 by 6 and 10 by 10 squares need a different method?
Sizes that are even but not divisible by four, called singly even, break both of the simpler rules. Conway's LUX method handles them by building a smaller odd square first and expanding each of its cells into a 2 by 2 block using one of three patterns.
How do I check a magic square is correct?
Add each row, each column and both diagonals, and confirm every one equals the magic constant. Then check that the numbers 1 to n squared each appear exactly once. This tool does all of that automatically and refuses to show a grid that fails.
Related tools
Sudoku Generator
Generate printable sudoku puzzles with a guaranteed unique solution. Choose easy to expert, rebuild any puzzle from its seed and download the answer key.
Nonogram Puzzle Generator
Draw a picture or trace an image into a grid and get a printable nonogram, with a solver that tells you honestly whether the clues can be worked out by logic alone.
Maze Generator
Generate printable mazes of any size with a guaranteed single solution path. Set the grid, overlay the answer route and download a crisp PNG.
Random Number Generator
Generate random numbers in any range with cryptographically secure randomness. Multiple numbers, no-repeat mode, sorting, plus dice and coin presets.
Binary Calculator
Do arithmetic and bitwise math on binary, decimal, hex and octal numbers — add, subtract, multiply, divide, AND, OR, XOR and shifts, with results in all bases.