Magic Square Generator
Generate magic squares of any size, check if squares are magic, and explore famous historical magic squares.
Magic Constant: 15
Every row, column, and diagonal sums to this value
| 8 | 1 | 6 |
| 3 | 5 | 7 |
| 4 | 9 | 2 |
Magic Constant Formula
M = n(n² + 1) / 2
For 3×3: M = 3(9+1)/2 = 15 | For 4×4: M = 4(16+1)/2 = 34
What is a Magic Square?
A magic square is a grid of numbers where every row, column, and main diagonal adds up to the same total, called the magic constant.
The Magic Constant
For an n×n magic square using numbers 1 to n², the magic constant is:
M = n(n² + 1) / 2
Famous Magic Squares
Lo Shu Square
The oldest known magic square, from ancient China (~2800 BC). According to legend, it was revealed on the back of a turtle emerging from the Lo River.
Dürer's Square
Featured in Albrecht Dürer's 1514 engraving "Melencolia I". The bottom row contains 15-14, giving the year 1514.
Magic Squares in Puzzles
Magic squares appear in geocaching and puzzles for:
- Finding missing numbers in incomplete squares
- Using the magic constant as a coordinate component
- Historical/mathematical themed puzzles
- Verification of number sequences