How to Make a Magic Square

This page will help you create a magic square of any size you like.


On other pages on this site, you can read how to make a magic square of odd size, or of size four by four or eight by eight and so on. As useful as those "magic square recipes" are, unfortunately,

  • They can't help you find a magic square of size 6 by 6, or 10 by 10, or so on...
  • Even for the size for which they can work, they only find one of the (usually) many millions of magic squares that are there.

So, what if you want a 6 by 6 magic square, or lots of different 5 by 5 magic squares? Well, it's simple. Just use this web page!

The java applet below knows how to make a magic square of any size. It can do a four by four square in the blink of an eye. Likewise, finding a five by five is very quick. Larger sizes are slower (my computer took 5 hours to find an 8 by 8 magic square!) but if you have enough patience, it will find them for you. If you're lucky, they'll be found very fast, even.

Just enter the size of the square you want, and press Start. If you want to stop it and try a different size, press Stop. The magic square will appear, just like, well, like magic!

Sorry, it seems that your browser can't support java applets

By the way, the java code for this magic square applet is available if you want it.

If you like what you've just read, sign up for this site's free newsletters:
  • Monday Morning Math: A weekly email of fascinating math facts - how math works in everyday life.
  • New Game Alerts: Be first to know when I upload new games.
Get these free now! Enter Your Email:
Then Click Here To Subscribe Now...
Or if you prefer, you can see past issues of the newsletters, or get more information before signing up.