All tools

Magic Square Generator

Generate a magic square (3x3 to 11x11).

Magic constant
65
17241815
23571416
46132022
101219213
11182529

A magic square has every row, column, and diagonal summing to the same value. Odd sizes use Siamese method (Bachet, 1612). Doubly-even sizes (n%4==0) use a marking method. Used in early cryptography, calendars, and as a meditation aid in many cultures.

About

Magic squares have rows, columns, and diagonals all summing to the same value. Odd sizes use the Siamese method. Even sizes use marking patterns. The constant for size n is n(n²+1)/2.

How to use

  1. Pick a size.

FAQ

Are these all valid magic squares?+

Odd-size and 4×4-multiple sizes generate genuine magic squares. The 6×10×14 sizes use a simpler row-major fill that isn't strictly magic - this is a placeholder for 'singly even' generation, which is more involved.