← All text tools

Magic Square Generator

Build a magic square of any order from 3 to 30 (odd, doubly even or singly even), see the magic constant, or type a square to check whether it is magic.

  • Free
  • No sign-up
  • Works on any device

About Magic Square Generator

A magic square arranges 1 to n² so every row, column and both diagonals add up to the same magic constant n(n² + 1)/2, which is 15 for order 3, 34 for order 4 and 111 for order 6. The generator uses the Siamese method for odd orders, the complement method for multiples of four and Strachey's method for singly even orders, and then checks the finished square. You can also type your own grid to find which sums fail.

How to use Magic Square Generator

  1. Choose Build a magic square and set the order n from 3 to 30.
  2. Read the magic constant, the grid and the method used, then copy the grid as tab-separated text.
  3. To test your own square, switch to Check, type one row per line, and see which rows, columns or diagonals do not match.

Why use this tool?

Also known as

Frequently asked questions

Why is there no magic square of order 2?

With the numbers 1 to 4 every row would need to add up to 5, but the only pairs that do so (1 + 4 and 2 + 3) cannot also work for the columns and diagonals, so none exists.

Is the square I get the only one of that order?

No. Order 3 has exactly one up to rotation and reflection, but order 4 has 880 and order 5 has over 275 million. This page builds one standard square for each order.

Can the checker handle numbers other than 1 to n²?

Yes. It reports whether all sums are equal for any numbers, and separately whether the square is normal, meaning it uses each of 1 to n² exactly once.

Is Magic Square Generator free?

Yes. Magic Square Generator on Toolipedia is free to use, with no sign-up and no watermark.

Is it safe to use?

Yes. Everything is worked out in your browser, and nothing you enter is sent to our server.

Does it work on my phone?

Yes. It works in any modern browser on Android and iPhone, as well as on tablets and computers. There's nothing to install.

Do I need an account?

No. Just open the page and use the tool. There's no sign-up and no email needed.