Stems, Branches and the 60 Jiazi Cycle
Gan-zhi is the coordinate system of the traditional Chinese calendar, formed by combining ten heavenly stems with twelve earthly branches.
The ten stems
Jia, Yi, Bing, Ding, Wu, Ji, Geng, Xin, Ren, Gui, in a fixed cycle. Jia, Bing, Wu, Geng, Ren are yang; Yi, Ding, Ji, Xin, Gui are yin.
The twelve branches
Zi, Chou, Yin, Mao, Chen, Si, Wu, Wei, Shen, You, Xu, Hai correspond to the twelve zodiac animals and the twelve two-hour periods of a day.
The 60 Jiazi cycle
Stems and branches pair in order: Jia-Zi, Yi-Chou, Bing-Yin… Since the least common multiple of 10 and 12 is 60, the cycle repeats every 60. Year, month, day and hour are each labelled with a pair, forming the Four Pillars.
Two critical boundaries
The year pillar changes at Li Chun (start of spring), not Lunar New Year; the month pillar changes at solar terms, not the first of the month. These are the most common sources of error — which is why Calendar & GanZhi computes strictly from solar terms.