Skip to content
D DocNectar

Free Magic Square Calculator

Verify whether a grid is a magic square, or generate an odd-order magic square using the Siamese method.

100% Free No Signup Works on all devices

Built and fact-checked by the DocNectar team — see our editorial standards

Thanks for rating!

Key Features

Instant Calculation

Get accurate results in real time with our optimized algorithm.

Mobile Friendly

Fully responsive design. Works on all devices & screen sizes.

Privacy Focused

Your data stays on your device. We don't store any inputs.

100% Free

No hidden costs. This tool is completely free forever.

A magic square is a grid of numbers where every row, column, and both diagonals sum to the same value (the magic constant). This tool can verify whether a grid you provide is a magic square, or generate a new one for any odd order using the classic Siamese method.

How it works

To verify, every row, column, and diagonal is summed and compared — if they all match, the grid is magic and that common sum is the magic constant. To generate an odd-order square, the Siamese method places 1 in the middle of the top row, then moves up-and-right for each subsequent number (dropping straight down when the up-right cell is already filled).

  1. Enter mode.
  2. Enter grid (rows separated by ";", numbers separated by ",").
  3. Enter size (n×n, odd only).
  4. Click Calculate to see your results.

Examples

A well-known 3x3 magic square

The grid [[2,7,6],[9,5,1],[4,3,8]] has every row, column, and diagonal summing to 15 — its magic constant.

Who should use it

  • Recreational mathematics and magic square puzzles.
  • Verifying homework or puzzle-book magic square answers.

Industry applications

  • Mathematics education
  • Recreational mathematics and puzzle design

Advantages

  • Both verifies existing grids and generates new odd-order squares.
  • Explains exactly which lines fail when a grid is not magic.

Limitations

  • Generation is limited to odd orders (3, 5, 7) via the Siamese method — even-order magic squares require a different algorithm.

Common mistakes to avoid

  • Assuming any grid with equal row sums is automatically a magic square — columns and both diagonals must also match for it to qualify.

Best practices

  • When verifying a magic square by hand, check the diagonals as well as rows and columns — it's easy to overlook the diagonals since there are only two of them.

Tips

  • If you need an even-order magic square, look into the LUX method or doubly-even construction techniques — the Siamese method used here does not apply to even orders.

Frequently asked questions

The Siamese method's specific placement rule (up-and-right, dropping down on collision) is only guaranteed to fill every cell exactly once when the grid size is odd; even-order magic squares require entirely different construction methods.
For an n×n magic square using the numbers 1 through n², the magic constant is n(n²+1)/2 — for example, a 3×3 square has magic constant 3×10/2 = 15.

Get new calculators and guides in your inbox

No spam — just new tools like Magic Square Calculator and practical guides.

Favorites