Magic Square Generator

Magic Square Generator

Generate magic squares of odd orders where every row, column, and diagonal sums to the same magic constant. Perfect for mathematical puzzles, number theory exploration, and educational demonstrations of the Siamese method algorithm.

magic
square
puzzle
Share this tool:
Quick Presets
Choose a magic square size to get started
Square Options
Select the size of your magic square

Odd-order sizes only — generated using the Siamese (De la Loubère) method

How it works: A magic square is a grid of distinct positive integers where every row, column, and main diagonal sums to the same value — the magic constant. For an n×n square the magic constant is n(n²+1)/2. This generator uses the classic Siamese method: place 1 in the middle of the top row, then move diagonally up-right for each successive number, wrapping around edges and dropping down when a cell is occupied.

Complete Guide: Magic Square Generator

Everything you need to know about using Magic Square Generator effectively