Math

Magic Square Calculator

Find the magic constant of an n×n magic square.

Parameters Live Compute
Calculated Output
Magic constant 15
Sum of all cells 45
Formula: M = n(n² + 1) ÷ 2
Step-by-Step Breakdown
1. Values used:
2. Square size (n) = 3
3.
4. Magic constant = 15
5. Sum of all cells = 45
Did this calculator solve your problem today?
Report issue to loopingon.com
Sponsored

A magic square uses the numbers 1 to n² so every row, column and diagonal sums to the same value.

The math behind it

The magic constant is M = n(n² + 1)/2. The grand total of all cells is n² (n² + 1)/2.

Worked Example

A 3×3 magic square has constant 3(9 + 1)/2 = 15.

Frequently Asked Questions

Do all sizes have magic squares?

Yes for every n ≥ 3 (and trivially n = 1); only n = 2 is impossible.

Advertisement