Magic Square Generator

Create a mysterious arrangement of numbers where every row, column, and diagonal adds up to the same total.

What is a magic square?

A magic square arranges the numbers 1 through n² in an n×n grid so that every row, every column, and both diagonals add up to the exact same total. This generator uses theSiamese method to build odd-sized magic squares.

A long history

The oldest known magic square, the "Lo Shu" square, is a 3×3 magic square from ancient China that has been treated as a mystical symbol for thousands of years. In Europe, the painter Albrecht Dürer famously engraved a 4×4 magic square into one of his prints — magic squares have fascinated people across East and West for centuries.

How is the magic constant calculated?

For an n×n magic square, the sum of every line (the magic constant) is given by the formula n × (n² + 1) / 2.

Try Another Number Puzzle

If you enjoy logic puzzles about filling in numbers, check out ourSudoku Game as well.

Frequently Asked Questions

Can I make an even-sized magic square?

Even-order magic squares do exist, but they require completely different algorithms (such as the doubly-even and singly-even methods) from odd-order squares, so this tool doesn't cover them.

Can I verify that the generated square is really correct?

Yes — try adding up the numbers in any row, column, or diagonal yourself, and you'll see they always produce the same magic constant.