According to Chinese legend, during a great flood, a mysterious turtle emerged from a river called the Luo. Its shell bore a pattern of numbers made of dots, and remarkably, every row, every column, and both diagonals added up to the same sum. This legendary pattern, known as the "Luoshu," is considered the very origin of what we now call the magic square. It's a story more than 3,000 years old, yet magic squares remain a subject that fascinates mathematicians and puzzle enthusiasts to this day.
The rule for a magic square is clear-cut. Fill a square using the numbers 1 through 9 (for a 3×3 square), each exactly once, so that all 8 lines — 3 rows, 3 columns, and 2 diagonals — add up to the same sum. For a 3×3 magic square, that sum can only ever be 15. Add up 1 through 9 and you get 45, and since that 45 must be split evenly across the 3 rows, 45÷3=15. By the way, the center cell must always hold 5 — since every line passing through the center (the middle row, the middle column, and both diagonals, 4 lines in total) shares that center number, it's impossible to make the sums work out unless it's the average value, 5.
In fact, there's really only one distinct 3×3 magic square. Rotate or flip (reflect) that single arrangement, though, and you get 8 versions that look different on the surface, but they're all essentially the same magic square. Once you move up to 4×4 or 5×5, the number of possible magic squares explodes — there are known to be a full 880 distinct 4×4 magic squares, and over 270 million distinct 5×5 magic squares.
Magic squares are more than a simple puzzle — they've been studied seriously throughout the history of mathematics. The German artist Albrecht Dürer included a 4×4 magic square in his 1514 work "Melencolia I," designing it so precisely that the two middle cells in the bottom row spell out the year he made it (1514). The Indian mathematical genius Ramanujan is also famous for an anecdote in which he improvised a magic square containing his own birth date on the spot. Magic squares sit right at the point where mathematical beauty meets artistic inspiration.
There's also a systematic way to build a magic square. Odd-sized squares (3×3, 5×5, 7×7…) can be filled in order using a simple rule called the "Siamese method": place 1 in the middle of the top row, then keep moving diagonally up and to the right for each next number, wrapping around to the opposite edge when you go off the grid, and dropping straight down one cell whenever you land on a cell that's already filled. Once you know this rule, you can complete a magic square of any odd size without ever getting stuck.
When trying this with kids, it helps to start with an "easy" level that has fewer blanks to get comfortable with the rule, then move on to levels with more blanks. Working backward to figure out what the remaining numbers must be for a row to add up to 15 naturally builds both addition and subtraction skills at once.
On our activity page, you can try magic squares with different numbers of blanks depending on the difficulty, and check in real time — with color — whether each line's sum matches 15. If you get stuck, use the hint button to fill in one cell at a time and finish the puzzle.