The 64 hexagrams are simply every combination of six yin/yang lines: three lines make a trigram, two trigrams make a hexagram. This page gives three interlocking views — an 8x8 matrix of upper against lower trigram, the eight-palace tree that shows how one palace is grown by flipping lines one at a time, and a comparison of the two numbering systems. Each hexagram has its own page, and every number on it is recomputed by the same engine: na jia stem-branches, six relations, shi/ying lines and the cuo, zong and hu relations — none of it copied.
Upper x lower trigram matrix
The columns are the upper (outer) trigram and the rows the lower (inner) one; where they meet is the King Wen number. Click any cell to open that hexagram.
Pick an upper and a lower trigram to go straight to the hexagram they form — the most direct use of the fact that the 64 hexagrams are just the complete combinations of the eight trigrams.
Pick both trigrams.
The eight palaces (8 x 8)
The eight palaces are the first way the 64 hexagrams get organised: each palace grows from one pure hexagram by flipping lines one after another, which splits all 64 into eight groups of eight. Because the grouping is computed, statements like "which palace, which generation, which line the shi sits on" can each be checked.
The King Wen sequence (1..64) and the binary (Fu Xi) sequence are two different numberings, and neither is wrong. The binary sequence treats the six lines as a six-bit number, so Kun (all yin) is 1 and Qian (all yang) is 64 — while King Wen puts Qian first and Kun second. So the two numberings are mirror images at head and tail, which you can verify right here.
A note on what this page deliberately does not do: the popular versions of this material assign a fixed personality to each term — one character per branch, one destiny per stage. This site rejects that framing. What is published here is a structural position: which element sits where, on what kind of ground, with which tenants inside. The same term reads differently under a different month command, and no meaningful judgement exists without the other characters of the chart. Where the tradition offers a reading it is labelled as the tradition's; this site's own contribution is that every number and term on this page is computed, versioned and checkable against the methodology page.
Questions
Where do the 64 hexagrams come from?
Three lines make a trigram, and stacking two trigrams gives 64 hexagrams: 8 x 8. The matrix on this page is exactly that — eight columns of upper trigram, eight rows of lower trigram, and any hexagram can be located by the two.
What is the difference between the King Wen and binary sequences?
They number the same 64 figures differently. The King Wen sequence is the received order of the Book of Changes (Qian 1, Kun 2, through Wei Ji 64). The binary sequence reads the six lines as a six-bit number from the bottom up, so Kun (all yin) is 1 and Qian (all yang) is 64. Both are given here; they are not mixed.
What are the eight palaces?
Jing Fang grouped the 64 hexagrams into eight families of change: each palace starts from its pure hexagram and flips line 1, then 2, then 3, then 4, then 5 to get the first through fifth generations, then flips line 4 back for the wandering hexagram and the inner three lines back for the returning one. Each palace holds exactly eight, and the eight tile all 64 without overlap.
What is na jia?
Na jia assigns a stem and branch to each of the six lines: Qian takes 甲 and 壬, Kun takes 乙 and 癸, and the other six trigrams keep one stem inside and out; yang trigrams step forward through the branches and yin trigrams step backward. Once each line has a branch, the six relations (parent, sibling, offspring, wealth, officer) follow from that branch element against the palace element. Every na jia value and relation on this site is computed.
Can these pages be used for divination?
This site publishes the structure of the notation: line polarity, na jia stem-branches, palace and shi/ying, the six relations, and the cuo/zong/hu relations — all computed, versioned and checkable. Casting methods and the reading of the classical line texts belong to the tradition, and this site does not speak for them or issue verdicts. That is the difference from the "hexagram of the day" pages: here you can check it, there you can only believe it.
Reference index
Every enumerable component of ba zi has its own page here. Each page is computed by the same engine and can be checked item by item — none of it is a personality table.