Magic Square Maker and Solver
Make magic squares from 3×3 to 9×9, complete a partly filled one, check a filled one and print worksheets
Loading the tool…
Makes magic squares, completes a partly filled one, checks a filled one and prints worksheets with an answer key, for checking a 3×3 homework answer or learning how magic squares are built.
How to use
- On "Make", choose a "Size"; the square, its magic constant and the line sums appear at once.
- "Other shape" shows a rotated, reflected or rearranged square; "Copy table" copies it for a spreadsheet.
- On "Check and solve", type the numbers you know into a 3×3 or 4×4 grid and press "Fill the blanks". A full grid is checked and wrong lines turn red.
- On "Worksheet", set the options and press "Print"; puzzles and answers print on separate pages. "New version" changes the puzzle number.
How it works
- The magic constant is n(n²+1)÷2: 15 for 3×3, 34 for 4×4, 65 for 5×5.
- How to make a 3×3 magic square (Siamese method): put 1 in the middle of the top row and each next number one cell up and to the right, wrapping around the edges; if that cell is taken, go one cell down instead. The result is 8 1 6 / 3 5 7 / 4 9 2.
- Sizes divisible by 4 are filled in order and each diagonal number v becomes n²+1−v; sizes such as 6 and 10 use the LUX method. Every result is re-checked.
Questions and answers
- What is the answer to the 3x3 magic square?
- Using 1 to 9 there is only one, up to rotation and reflection: 8 1 6 / 3 5 7 / 4 9 2. The centre is always 5 and every line adds up to 15.
- How do you make a 4x4 magic square?
- Write 1 to 16 in order, then replace each number on the two diagonals with 17 minus it. You get 16 2 3 13 / 5 11 10 8 / 9 7 6 12 / 4 14 15 1, with sum 34.
- How do I solve a magic square with blanks?
- Enter the given numbers on "Check and solve" and press "Fill the blanks"; a backtracking search finds an answer and says whether it is the only one.
- Can I print the same worksheet again?
- Yes. The same "Puzzle number (seed)" gives the same puzzles and answers.