Magic Square Puzzle
Fill in numbers so every row, column and diagonal adds up to the same magic sum. A classic mathematical puzzle enjoyed for thousands of years.
š¢ Number Puzzle
š§© Logic Game
ā±ļø Timed Challenge
ā±ļø
00:00
ā
0 / 3
š
0 / 0
Magic Sum: 15
Game Introduction
š Overview
Magic Square Puzzle is a classic number placement game with roots in ancient China (the Lo Shu square, ~2200 BC). You are given an NxN grid where some numbers are already placed. Your goal is to fill in all the remaining cells using the numbers 1 through N², such that every row, every column, and both main diagonals add up to the same "magic constant." This constant is calculated as N(N²+1)/2.
š Rules
- Fill the NxN grid with the numbers 1 to N² (each used exactly once)
- Every row must sum to the magic constant
- Every column must sum to the magic constant
- Both main diagonals must sum to the magic constant
- Pre-filled (gray) numbers cannot be changed
- You have 3 mistakes allowed before game over
- Each puzzle has exactly one valid solution
š® Controls
- Click Cell: Select an empty cell to fill
- Number Pad: Click a number to enter it into the selected cell
- Keyboard: Type a number directly (for 2-digit numbers, type both digits quickly)
- Delete/Backspace: Clear the selected cell
- Arrow Keys: Navigate between editable cells
- Undo: Reverse your last move
- Hint: Reveal one correct number
- Check: Verify all filled answers
š Scoring
- Complete the puzzle as quickly as possible
- Minimize mistakes (maximum 3 allowed)
- Higher difficulties use larger grids (up to 7Ć7)
- Use fewer hints for a better personal challenge
- Timer starts when you make your first move
š” Tips
- Start with rows or columns that have only one missing number ā simple subtraction gives the answer
- The center cell of an odd-order magic square always equals (N²+1)/2
- Corner cells and edge cells have constraints from both a row and a column (corners also from a diagonal)
- Use the sum indicators on the side to track which rows/columns are complete
- For 3Ć3, the magic constant is always 15; for 4Ć4 it's 34; for 5Ć5 it's 65
- If you're stuck, use Hint sparingly ā it reveals one correct cell
ā FAQ
What is a Magic Square?
A magic square is an NxN grid filled with distinct positive integers where the sum of every row, column and both main diagonals equals the same number, called the magic constant.
How do I calculate the magic constant?
For an NxN magic square using numbers 1 to N², the magic constant is N(N²+1)/2. For example, a 3Ć3 square has a magic constant of 15, and a 4Ć4 square has a magic constant of 34.
What difficulty levels are available?
There are five levels: Beginner (3Ć3 with many clues), Easy (3Ć3 with fewer clues), Medium (4Ć4), Hard (5Ć5), and Master (7Ć7). Higher levels have larger grids and fewer pre-filled numbers.
Can I play on mobile?
Yes! The game is fully responsive and works on all devices including phones and tablets. Use the on-screen number pad to enter values.
Is there always exactly one solution?
Yes, every puzzle generated in this game has exactly one valid solution. The generator uses a backtracking solver to verify uniqueness before presenting the puzzle.