Magic Square Builder
A magic square packs the numbers 1 to n² into a grid where every row, every column and both diagonals add up to the same magic constant. This builder constructs them live for any size — the Siamese method stepping diagonally for odd orders, the elegant complement trick for doubly even orders, and the LUX method for the awkward singly even sizes — with the sums checked and highlighted so you can verify the magic yourself.
Runs 100% in your browser — simulations are computed locally on your device.
Read the full guide to this tool
Notes
- The magic constant is n(n² + 1)/2 — for the classic 3×3 square it is 15.
- The Siamese method: go up-right, wrap around the edges, drop down one when blocked.
- Dürer’s 1514 engraving Melencolia I hides a 4×4 magic square with the date in the bottom row.
- Runs 100% in your browser — simulations are computed locally on your device.